+ 1

Mid task "That's odd..." on Python

Good day everyone! Faced the problem with solving this task. Can't understand what should I use in this code in order to create "n" numbers of lines which depends from the number which is in the first input? For examle: 3. It means that program should create 3 lines after 1-st input. I've read about "Diego code" on the Internet but unsuccessfully. If you can give any useful information about it or maybe solving of this problem, I'll be grateful! 🙏

16th Sep 2020, 8:14 AM
Nikolay S
Nikolay S - avatar
8 odpowiedzi
+ 1
You take n from the user then create a loop for i in range(n) take input in the loop that will take inputs n times
16th Sep 2020, 8:36 AM
Ruba Kh
Ruba Kh - avatar
+ 1
Try this: count = 0 for i in range(int(input())): num = int(input()) count += [num, 0][num % 2] print(count)
16th Sep 2020, 8:38 AM
Bagon
Bagon - avatar
+ 1
Thanks to all for help! Brainstorming gave me add information about it. Also understood how works bottom "Enter" on phone😂 Earlier didn't see it🙈. Bhavya Sarraf your code really works, i'll learn it deeper in order to understand it in whole. My greatest thanks to you))
16th Sep 2020, 10:19 AM
Nikolay S
Nikolay S - avatar
+ 1
Vasya Petrov no problem, IDK why it doesn't work for you, doesn't show any errors for me
16th Sep 2020, 12:10 PM
Bagon
Bagon - avatar
0
Bagon your code don't work unfortunately but anyway thank you for spending your time on it.
16th Sep 2020, 10:20 AM
Nikolay S
Nikolay S - avatar
0
Bagon you was right. Sry for my fail. It works correctly. Idk why it didn't work at the first time. Thank you for feedback
16th Sep 2020, 12:41 PM
Nikolay S
Nikolay S - avatar