+ 1
Please I'm new here what is missing in my code
def multi(x, y): while x * y: x = int(input('Enter the value of x: ')) y = int(input('Enter the value of y: ')) print('The product of X and Y is' multi(x, y))
5 Respuestas
+ 1
It's working. Do you still have any question regarding this?
0
Oh just did some tweaking
def multiply(x, y):
return x * y
a = int(input('Enter the value of A: '))
b = int(input('Enter the value of Y: '))
operation = multiply
print(operation(a, b))
0
This one works too:
def multi(x, y):
return x * y
x = int(input('Enter the value of x: '))
y = int(input('Enter the value of y: '))
print('The product of X and Y is', multi(x, y))
0
rahim thanks, I'm still having trouble knowing when to use 'while' or if
0
They are very similar, but if will be used when you want to run the block of code just once whereas while is a loop and runs the code until the while statement is true