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
5.16 Implement function indexes() that takes as input a word (as a string) and a onecharacter...
5.16 Implement function indexes() that takes as input a word (as a string) and a onecharacter letter (as a string) and returns a list of indexes at which the letter occurs in the word. >>> indexes('mississippi', 's') [2, 3, 5, 6] >>> indexes('mississippi', 'i') [1, 4, 7, 10] >>> indexes('mississippi', 'a') []
4.31 Implement function duplicate() that takes as input the name (a string) of a file in...
4.31 Implement function duplicate() that takes as input the name (a string) of a file in the current directory and returns True if the file contains duplicate words and False otherwise. duplicate('Duplicates.txt') True duplicate('noDuplicates.txt') False Please solve using Python Language and without using str.maketrans please. Just simple programming, Thank youuuuu!!!!!
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.
Using C: Implement function types that takes no input, declares 3 variables of type char, 3...
Using C: Implement function types that takes no input, declares 3 variables of type char, 3 of type short, 3 of type int, and 3 of type double---in that order---and prints the addresses of the 12 variables---in the same order---in both hex (use %p conversion instruction) and unsigned long format. &a1 = 0x7ffd45e3ac0f, 140725776002063 &a2 = 0x7ffd45e3ac0e, 140725776002062 &a3 = 0x7ffd45e3ac0d, 140725776002061 &b1 = 0x7ffd45e3ac0a, 140725776002058 &b2 = 0x7ffd45e3ac08, 140725776002056 ...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT