+ 2
why isn't my code working (python)?Also tell how to make loop in python
a=input("Tell the first number--") b= input("Tell the second number--") c=a*b Print( a , " multiplied by " , b , " equals ", c ) x= input("Do you want to run the program again") if x=="yes" a=input("Tell the first number--") b= input("Tell the second number--") c=a*b Print( a , " multiplied by " , b , " equals ", c ) else Print("Bye Bye..") I ran the code in Virtual Studio Code and it showed error in if statement Please tell solution Also tell how to make loop (in reference to this code)
4 Answers
+ 5
You forget to give : (colon) after if statement and also in else statement
+ 5
a=input("Tell the first number--")
b= input("Tell the second number--")
c=a*b
Print( a , " multiplied by " , b , " equals ", c )
x= input("Do you want to run the program again")
if x=="yes":
while True:
a=input("Tell the first number--")
b= input("Tell the second number--")
c=a*b
Print( a , " multiplied by " , b , " equals ", c )
else:
Print("Bye Bye..")
+ 4
Correct it as
if x=="yes":
+ 2
Thanks for help