In: Computer Science
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"
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()
CODE: Python Programming Language
def greeting(user):
print("Hello, {}".format(user))
def multiply2nums(num1, num2):
return num1 * num2
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()
=======================================================================
SCREENSHOT OF THE CODE:
=======================================================================
OUTPUT:
Thank you. Please ask me if you have any doubt.