In: Computer Science
Write the functions needed by the main function that is given.
multiply2nums should accept 2 values and return the product
(answer you get when you multiply).
greeting should accept one value and print an appropriate greeting
using that value. For example, if you sent "Steven" to the greeting
function, it should print "Hello, Steven"
DO NOT CHANGE ANYTHING IN main()
def main():
user = input("Please enter your name ")
greeting(user)
try:
num1 = int(input("Please enter an integer "))
num2 = int(input("please enter another integer "))
result = multiply2nums(num1,num2)
print("The product of your two numbers is ",result)
except:
print("Error found in input")
main()
PROGRAM :
def greeting(user): # + is used to concatenate two strings greeting_string = "Hello,"+user print(greeting_string) # multiply2nums to multiply the numbers and return the product def multiply2nums(num1,num2): return num1*num2 # main untouched as requested in the question def main(): user = input("Please enter your name ") greeting(user) try: num1 = int(input("Please enter an integer ")) num2 = int(input("please enter another integer ")) result = multiply2nums(num1,num2) print("The product of your two numbers is ",result) except: print("Error found in input") # function call main()
OUTPUT :