Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 1 Write a Python function called hasVowels0 that takes in a string param

ID: 3762015 • Letter: P

Question

Problem 1 Write a Python function called hasVowels0 that takes in a string parameter mystring. It should then go through mystring and return True if mystring has at least one vowel, and return False otherwise. Problem 2 Write a Python function called factorial0 that takes in an integer parameter num, and returns the factorial of num. Problem 3 Write a Python function called ion2e() that takes in a string parameter word. If word ends in 'ion', it should replace 'ion' with 'e' and return the new word. Otherwise, it lust returns the original word. (Textbook problem 3.42, Page 92) Problem 4 Write a Python function called parlition0 that takes in a list of strings called players, as parameter, and returns a new list consisting of only those strings from the original which begin with a letter from A to M (inclusive). (Textbook Problem 3.38. Page 92) Problem 5 Write a Python function called distanced that takes In an int parameter called time which Is the time elapsed in seconds between the flash and the sound of thunder. The function should return the distance from lighting strike in kilometers. The speed of sound can be assumed to be 340.29 meters and there are 1000 meters in a kilometer. (Textbook problem 3.43, Page 93)

Explanation / Answer

1.

def hasVowels(string):

if len(set(string) & set('aeiou')):

return True

else:

return False

output:

hasVowels('test')

True

2).

def factorial(n):

if n==0:

return 1

else:

return n*factorial(n-1)

output:

factorial(5)

120

3)

def ion2e(string):

if string.endswith('ion'):

return string[:len(string)-3]+'e'

else:

return string

output:

ion2e('testion')

teste

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote