+ 1

While and For

Can this code be make with "while" instead of "for"? https://code.sololearn.com/c1av1rXJE24W/?ref=app

8th Jul 2018, 2:59 AM
I Am Arthur
I Am Arthur - avatar
8 ответов
+ 3
This is just an edited version of your code that included both methods d: https://code.sololearn.com/cD7R4oSDBIkT/?ref=app
8th Jul 2018, 3:33 AM
Faisal
Faisal - avatar
+ 2
Generally, using for loops can often be replaced by while loops, with this instance being no exception. All you would really need to do to do so is declare i before the loop and at the end, increase i by 1 to make it similar to how the for loop would run. i = 2 while i < x: #Statement(s) i += 1
8th Jul 2018, 3:22 AM
Faisal
Faisal - avatar
+ 2
Arthur No problem! I'm always glad to help out d:
8th Jul 2018, 3:42 AM
Faisal
Faisal - avatar
+ 2
Arthur Haha thanks! I don't think I would consider myself a genius, but I do try to help out as many people as I can as I know that it can be difficult to start off learning how to code :)
8th Jul 2018, 3:58 AM
Faisal
Faisal - avatar
+ 1
Faisal Can you show me this on code?
8th Jul 2018, 3:30 AM
I Am Arthur
I Am Arthur - avatar
+ 1
Faisal Thank you so much.For and while is always difficult for me but you made me understand a lot of how they actually work
8th Jul 2018, 3:41 AM
I Am Arthur
I Am Arthur - avatar
+ 1
Faisal Are u like what?A genius that knows everything and keeps travel around the world helping people with your knowledge? lol
8th Jul 2018, 3:50 AM
I Am Arthur
I Am Arthur - avatar
+ 1
Faisal ( i saw your profile and realize that you helped a lot of people...)
8th Jul 2018, 3:51 AM
I Am Arthur
I Am Arthur - avatar