In: Computer Science
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
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