0
How to make this code with python
hello all.. so my question is how to make this input 5 4 2 into this output 2 -6 10 -14 18 10 okay here 5 is how many row output will be print 4 is like step in loop 2 isi start like loop and six row you will see 10 we want 5 row but there is 10 at six row? that was the result of all 5 row(2+(-6)+10+(-14)+18=10) okay thats the result and first start positive and second negative and so on like example so i want ask here.. how to make thay code in python using beginner mode code and explanation? Thank You
7 Answers
+ 3
here's your code. 😁
https://code.sololearn.com/cp03TJa0Eg9g/?ref=app
+ 3
you want the result like this
2
-6
10
-14
18
10 (option 1)
like this
2
-6
10
-14
18 (option 2)
or like this
2+(-6)+10+(-14)+18=10 (option 3)?
+ 1
option 1
+ 1
flag is a Boolean variable and it takes true or false values. I use it to determine where in the if-clause I'll end up.
0
what is the meaning of flag = FALSE?
and why you use flag?
0
okay... soo is there any code that we dont need to use boolean?
0
you usually have to make some logical comparisons.