- 3

Help it is impossible

Z=100 while Z>=0 : if("miss"): Z=Z-20 if("hit"): Z=Z+10 print(Z)

8th Aug 2021, 7:59 PM
Ryad Âhméd
8 odpowiedzi
+ 2
Ryad Âhméd, [Edited] You may want to re-visit this lesson: https://www.sololearn.com/learning/2277/ If you still face problem, feel free to share the original question.
8th Aug 2021, 8:14 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 1
In Python, all letters are interpreted as True, you can check this: print(bool("miss")) #>>> True print(bool("hit")) #>>> True As a result, with each iteration, Z will decrease by 10 until it becomes less than 0. P. S: "Add python tag to your question".
8th Aug 2021, 8:18 PM
Solo
Solo - avatar
+ 1
Your code won't work since "miss" and "hit" will always evaluate to a True statement.
10th Aug 2021, 4:48 AM
Calvin Thomas
Calvin Thomas - avatar
0
You’ve made mistake in the if else statement man! Revise your if/else lesson. Or add what are you trying to do
8th Aug 2021, 8:06 PM
Iftekhar Ahmed Pranto
Iftekhar Ahmed Pranto - avatar
0
Pranto how can i solve?
8th Aug 2021, 8:07 PM
Ryad Âhméd
0
Use if else and also you want to Z-=20 and Z+=10
8th Aug 2021, 11:38 PM
Anthony Johnson
Anthony Johnson - avatar
0
unable to understand miss and hit variable of if condition. If you clear it then, i will try to solve it
10th Aug 2021, 1:12 AM
Abhishek Kumar
Abhishek Kumar - avatar
- 3
Shamima Yasmin how i already shared on discussing section
8th Aug 2021, 8:05 PM
Ryad Âhméd