Question

In: Computer Science

Implement function noVowel() that takes a string s as input and returns True if no char-...

Implement function noVowel() that takes a string s as input and returns True if no char- acter in s is a vowel, and False otherwise (i.e., some character in s is a vowel). >>> noVowel('crypt') True >>> noVowel('cwm') True >>> noVowel('car') False

Implement function allEven() that takes a list of integers and returns True if all integers in the list are even, and False otherwise.

>>> allEven([8, 0, -2, 4, -6, 10])

True

>>> allEven([8, 0, -1, 4, -6, 10])

False

Solutions

Expert Solution

def NoVowel(myStr):

#converting to uppercase

myStr=myStr.upper()

#iterating each char and checking it is vowel,than return false

for x in myStr:

if x=='A' or x=='E' or x=='I' or x=='O' or x=='U':

return False

return True

print(NoVowel("BCD"))

print(NoVowel("uday"))

Answer 2:

def allEven(myList):

for x in myList:

#converting negatives into positive

if x<0:

x=x*-1

#checking if any value is odd than return false

if x % 2==1:

return False

return True

print(allEven([8, 0, -2, 4, -6, 10]))

print(allEven([8, 0, -1, 4, -6, 10]))

Note : If you like my answer please rate and help me it is very Imp for me


Related Solutions

Python Implement function noVowel() that takes a string s as input and returns True if no...
Python Implement function noVowel() that takes a string s as input and returns True if no char- acter in s is a vowel, and False otherwise (i.e., some character in s is a vowel). >>> noVowel('crypt') True >>> noVowel('cwm') True >>> noVowel('car') False
python 3 please Define a function voweliest that takes as input a string and returns as...
python 3 please Define a function voweliest that takes as input a string and returns as output a tuple where the string that has the most vowels in it is the first element and the second is the number of vowels in that string. Note: don't worry about ties or capital letters Hint: consider defining and using a separate function that counts the number of vowels in a given string
Write a recursive method using Java that takes a string s as input and returns a...
Write a recursive method using Java that takes a string s as input and returns a list that contains all the anagrams of the string s. An anagram is a word formed by rearranging the letters of a different word. For instance, the word ‘cat’ is an anagram of ‘act’. Notice that the output list cannot contain duplicates.
Write a Java method that takes an array of char and a String as input parameters...
Write a Java method that takes an array of char and a String as input parameters and and returns an boolean. The method returns true if we can find the input string inside the array by starting at any position of the array and reading either forwards or backwards.
Write a recursive Racket function "remove-char" that takes two string parameters, s and c, and evaluates...
Write a recursive Racket function "remove-char" that takes two string parameters, s and c, and evaluates to string s with all occurrences of c removed. The string c is guaranteed to be a length-1 string; in other words a single character string. For example (remove-char "abc" "b") should evaluate to "ac". Here is pseudocode that you could implement.
Write a function that takes a C string as an input parameter and reverses the string.
in c++ Write a function that takes a C string as an input parameter and reverses the string. The function should use two pointers, front and rear. The front pointer should initially reference the first character in the string, and the rear pointer should initially reference the last character in the string. Reverse the string by swapping the characters referenced by front and rear, then increment front to point to the next character and decrement rear to point to the...
Write a function that takes a number as input, and returns the character A if the...
Write a function that takes a number as input, and returns the character A if the input is 90 and above, B if it’s 80 and above but less than 90, C if it’s at least 70 but less than 80, D if it’s at least 60 but less than 70, and F if it’s less than 60. If the input is not a number or is negative, the function should exit 1 with an error (by calling the Matlab...
c++ Write the definition of a function named ‘isLower’ that takes as input a char value...
c++ Write the definition of a function named ‘isLower’ that takes as input a char value and returns true if the character is lowercase; otherwise, it returns false.•Print the message “The character xis lowercase” when returned value above is true, and vice versa.
Implement the following function: a. float temp(float t, char ch) – this function takes temperature ‘t’...
Implement the following function: a. float temp(float t, char ch) – this function takes temperature ‘t’ and unit of temperature ‘ch’ as parameter. The variable ‘ch’ will be either f or c depending on whether the temperature in variable ‘t’ is in Fahrenheit or Celsius. The function returns the converted temperature to the main method. Call the above function in the main method. Initialize temperature and unit of temperature from the user and pass them as parameter to the above...
write a function that takes as input the root of a general tree and returns a...
write a function that takes as input the root of a general tree and returns a binary tree generated by the conversion process illustrated in java
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT