Python wrong count | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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