0

How to create 1 2 4 7 11 16 22 ...... <=100 pattern in python only using while repetition

pseudocode I created, Begin a=0 b=1 c=a+b While c<=100 : print c a=c b=b+1 Endwhile End

15th Jun 2022, 1:56 PM
NINJA YT
NINJA YT - avatar
3 ответов
+ 2
Translate this into code let number = 1 let addition = 1 repeat while number <= 100 print number, with a space in place of line break at end of line increment number by addition increment addition by 1
15th Jun 2022, 3:26 PM
Ipang
+ 1
Start the Python for Beginners course, then try to translate the pseudo code to Python.
15th Jun 2022, 2:09 PM
Lisa
Lisa - avatar
+ 1
You need to change a = 1 and b = 0 Also, in the while loop you are not incrementing c, therefore add 'a' and 'b' to c before the while loop ends.
15th Jun 2022, 2:51 PM
Sandeep
Sandeep - avatar