5.36. Functions and Loops Write Code Questions¶
Write a function called
list_starts_with_athat takes inlstas a parameter and returns a new list with the words fromlstthat start with “a”. For example,list_starts_with_a(["alphabet", "apple", "banana", "coding", "amazing"])would return["alphabet", "apple", "amazing"].Write a function called
list_starts_with_athat takes inlstas a parameter and returns a new list with the words fromlstthat start with “a”. For example,list_starts_with_a(["alphabet", "apple", "banana", "coding", "amazing"])would return["alphabet", "apple", "amazing"].-
Write a function called
sentence_without_vowelsthat takes instringas a parameter and returns a new string that consists of only characters that are not vowels. For example,sentence_without_vowels('apple')would return"ppl". Write a function called
draw_squarethat takes innumas a parameter and returns a string that consists of a square made of “*” with the dimensionsnumtimesnum. Note: ignore values that are less than or equal to zero. For example,draw_square(4)would return"****\n****\n****\n****".Write a function called
draw_squarethat takes innumas a parameter and returns a string that consists of a square made of “*” with the dimensionsnumtimesnum. Note: ignore values that are less than or equal to zero. For example,draw_square(4)would return"****\n****\n****\n****".-
Write a function called
check_prime_numthat takes innumas a parameter and returnsTrueifnumis a prime number andFalseotherwise. For the purposes of this question, there is no need to test for values ofnumthat are less than two. For example,check_prime_num(5)should returnTrue. Write a function called
factorialthat takes innumas a parameter and returns the factorial value. Ignore checking numbers that are less than 1. For example,factorial(5)would return120.Write a function called
factorialthat takes innumas a parameter and returns the factorial value. Ignore checking numbers that are less than 1. For example,factorial(5)would return120.