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

15th Oct 2017, 5:37 PM
Jansen Su
Jansen Su - avatar
7 Answers
17th Oct 2017, 1:48 PM
Αντώνης Βήχος
Αντώνης Βήχος - avatar
+ 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)?
17th Oct 2017, 1:04 PM
Αντώνης Βήχος
Αντώνης Βήχος - avatar
+ 1
option 1
17th Oct 2017, 1:05 PM
Jansen Su
Jansen Su - avatar
+ 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.
18th Oct 2017, 11:57 AM
Αντώνης Βήχος
Αντώνης Βήχος - avatar
0
what is the meaning of flag = FALSE? and why you use flag?
18th Oct 2017, 10:54 AM
Jansen Su
Jansen Su - avatar
0
okay... soo is there any code that we dont need to use boolean?
18th Oct 2017, 6:17 PM
Jansen Su
Jansen Su - avatar
0
you usually have to make some logical comparisons.
19th Oct 2017, 5:13 AM
Αντώνης Βήχος
Αντώνης Βήχος - avatar