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

5th Aug 2020, 3:21 AM
Raghu Rao
Raghu Rao - avatar
4 Answers
+ 5
You forget to give : (colon) after if statement and also in else statement
5th Aug 2020, 3:32 AM
ツSamarthツ
ツSamarthツ - avatar
+ 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..")
5th Aug 2020, 3:28 AM
ツSamarthツ
ツSamarthツ - avatar
+ 4
Correct it as if x=="yes":
5th Aug 2020, 3:33 AM
ツSamarthツ
ツSamarthツ - avatar
+ 2
Thanks for help
5th Aug 2020, 3:32 AM
Raghu Rao
Raghu Rao - avatar