guess the number | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

guess the number

Why are my tried not increasing…. Not working? https://code.sololearn.com/WBbAqvh6iN2n/?ref=app

27th Mar 2022, 1:22 AM
Junior
Junior - avatar
7 Answers
+ 1
We can define a condition for that. I'm taking user input for just that. https://code.sololearn.com/Wzzi1eL707Z5/?ref=app
27th Mar 2022, 2:01 AM
zexu knub
zexu knub - avatar
0
It is increasing, but since it's not in a loop the code is terminating after reading the last prompt value.
27th Mar 2022, 1:33 AM
zexu knub
zexu knub - avatar
0
Okay its in a loop now and still not workin?
27th Mar 2022, 1:34 AM
Junior
Junior - avatar
0
Wrong syntax
27th Mar 2022, 1:35 AM
zexu knub
zexu knub - avatar
0
What wrong? Can u show me?
27th Mar 2022, 1:36 AM
Junior
Junior - avatar
0
It's not efficient what you want to do, but wrapping the whole code except the initial assignment of trys = 0 in a while loop would work.
27th Mar 2022, 1:49 AM
zexu knub
zexu knub - avatar
0
Okay…so like: while(what would i put here?) { code… } trys = 0;
27th Mar 2022, 1:51 AM
Junior
Junior - avatar