Python wrong count | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Python wrong count

For example: Input is 42 18 16 2 1. Output is 500, not 300. What’s wrong? https://code.sololearn.com/cLjb5vi7hoYx/?ref=app

10th Jun 2021, 6:09 AM
Ilya Vasilyev
Ilya Vasilyev - avatar
5 Answers
+ 3
Ilya Vasilyev Problem is in taking input. You are taking input only once even you have to take inside loop because inputs are given in separate lines. And also you have to skip those age groups which are less than 3. https://code.sololearn.com/chtZ0GCAle8t/?ref=app
10th Jun 2021, 7:37 AM
A͢J
A͢J - avatar
+ 4
You are looping 5times for only single input of 1st person age. You have take 5 inputs in loop..
10th Jun 2021, 7:38 AM
Jayakrishna 🇮🇳
+ 2
Ilya Vasilyev , what's the description of the task?
10th Jun 2021, 6:48 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
TheWh¡teCat 🇧🇬 Practice 26.3 in Python For Beginners
10th Jun 2021, 7:47 AM
A͢J
A͢J - avatar
0
Ilya Vasilyev you need to give inputs one by one in new line...and no need to use x -= 1 2 times You can do that once only ...in last line of that loop block
11th Jun 2021, 3:48 PM
sudhir meena
sudhir meena - avatar