+ 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))

7th Apr 2019, 10:51 PM
"Michael + O'fade"
"Michael + O'fade" - avatar
5 Respuestas
+ 1
It's working. Do you still have any question regarding this?
8th Apr 2019, 1:22 AM
Шащи Ранжан
Шащи Ранжан - avatar
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))
7th Apr 2019, 11:25 PM
"Michael + O'fade"
"Michael + O'fade" - avatar
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))
8th Apr 2019, 5:21 AM
rahim
rahim - avatar
0
rahim thanks, I'm still having trouble knowing when to use 'while' or if
8th Apr 2019, 8:49 AM
"Michael + O'fade"
"Michael + O'fade" - avatar
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
8th Apr 2019, 9:11 AM
rahim
rahim - avatar