+ 1

I tried to use while loop in my previous calculator program. But it showing error in line 18

https://code.sololearn.com/cd9jnmlv6e0k/?ref=app

9th Aug 2019, 2:35 AM
sathya
sathya - avatar
5 Antworten
+ 11
sathya some indentation errors in your code and x is not defined before use that cause program to bit executed. Here is updated code https://code.sololearn.com/cdRKtHGfG24M/?ref=app
9th Aug 2019, 3:27 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 10
sathya you can initialise with 0 to. As your code while loop condition is x<=5 so for 5 cases it will execute. You can also use while condition in different ways like this one contain = "y" while contain == "y" or cont == "Y":
9th Aug 2019, 3:34 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
GAWEN STEASY why we should initialize x as 1 .
9th Aug 2019, 3:29 AM
sathya
sathya - avatar
+ 1
GAWEN STEASY thank u
9th Aug 2019, 3:35 AM
sathya
sathya - avatar
0
GAWEN STEASY is there any way I could enter choice as many times but when x=5 . Loop stops .
9th Aug 2019, 3:54 AM
sathya
sathya - avatar