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

Write a function named modTest that takes a number as input and does all of the

ID: 3811502 • Letter: W

Question

Write a function named modTest that takes a number as input and does all of the following: 1) Determine if the input is even or odd and display the results in the format shown below. 2) Determine if the input is evenly divisible by 4 and display the results in the format below. (There is no need to print that it is not divisible by 4) 3) Determine if the ones position of the input is a 3. (There is no need to print if the ones position of the input is not a 3) 1) Copy the modTest function and rename the function modTestWithPrompts. 2) Modify the function so that the function takes no inputs. 3) In the function, use the requestInteger function to prompt the user for input when the function is run.

Explanation / Answer

# this code is implemented in pyhton 3.6

#Problem 1

def modTest(num):

if num%2==0:

print("The Number"+ str(num)+" is even")

if num%4==0:

print("The Number %d is evenly divisible by 4",num)

else:

print("The Number %d is odd",num)

temp=num%10

if temp==3:

print("%d has the ones positioin of 3",num)

#Problem 2

def requestInteger():

num=Input()

return int(num)

def modTestWithprompt():

num=requestInteger()

if num%2==0:

print("The Number"+ str(num)+" is even")

if num%4==0:

print("The Number %d is evenly divisible by 4",num)

else:

print("The Number %d is odd",num)

temp=num%10

if temp==3:

print("%d has the ones positioin of 3",num)

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