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

Write a Python program that implements several functions. The functions you need

ID: 3796026 • Letter: W

Question

Write a Python program that implements several functions. The functions you need to provide are: doubly (x) this function takes a value x that you pass it then returns x doubled, i.e., multiplied by 2. triply (x) this function takes a value x that you pass it then returns x tripled, i.e., multiplied by 3 canibuybeer (age) this function takes a value age that you pass it. If the age is greater than or equal to 21 the function returns True, otherwise it returns False. Make sure your program also contains a Main() function as shown in Syntax 5.2 on page 250. In your Main function CALL each of your functions with the values shown below (and of course don't forget to call your Main function otherwise nothing will happen)

Explanation / Answer

def doubly(x):
return 2*x
  
def triply(x):
return 3*x

def canIbuybeer(age):
if age >= 21:
return True
else:
return False

def Main():
print doubly(22)
print triply(19)
print canIbuybeer(30)
print canIbuybeer(17)

Main()

# pastebin link incase indentation is messed up http://pastebin.com/7XCArkLf

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