0

What is wrong here? (Python)

It will output True if steps is greater than 1000 and it will output True if active_minutes is greater than 30. But what shouldn't be is that it will also output True if neither of the two aspects apply. Does anyone know the solution? Code: # Take steps and minutes as inputs steps = int(input()) active_minutes = int(input()) # Store the result of the operations in the variable goal_achieved = steps > 1000 or active_minutes > 30 # Display the result on the screen print(goal_achieved)

17th Mar 2024, 6:01 PM
Clara
12 ответов
+ 5
10000 (ten thousand) steps Not 1000 (one thousand) If we're looking at the same problem (Python - Fitness Goal challenge)
17th Mar 2024, 6:21 PM
Sam
+ 8
pasos = int(input()) minutos_activos = int(input()) # Almacenar el resultado de las operaciones en la variable objetivo_alcanzado = pasos > 1000 and minutos_activos > 30 The problem is that you are using operator (or) to verify if one of the two are true, to do this you must use the operator (and) to evaluate the two that must be True.Otherwise, if True is not evaluated, it will result in False.
17th Mar 2024, 7:06 PM
STE4LPH
STE4LPH - avatar
+ 6
Clara Götz , it would have been easier for everyone if a proper task description had been included. additional a reference to the tutorial (name) and the name of the exercise would have been a great help.
17th Mar 2024, 7:44 PM
Lothar
Lothar - avatar
+ 4
OMG, that’s It! I just forgot a zero🙈 With the additional zero it works. I had actually already tried the “and” in my time of need. The problem with the task was that the fitness program should return true if one of the two parameters was correct. I didn't explain that here. But thank you very much for the answers. it's very cool to have this community🙂
17th Mar 2024, 7:17 PM
Clara
+ 3
Thank you for your kind words. It's crazy how you can fail so much because of such a stupid mistake. Sometimes you're just blind. I've looked for the error everywhere but there. and if you don't find the error, you slowly come to the brink of madness😂😂😂
17th Mar 2024, 7:32 PM
Clara
+ 3
Hi, absolutely agree. I will do this next time.
17th Mar 2024, 7:46 PM
Clara
+ 3
Clara Götz , Python allows gratuitous _ underscores in numeric literals, which can make them easier to read. 1_000 10_000
17th Mar 2024, 8:05 PM
Rain
Rain - avatar
+ 2
Clara Götz you're already programming just like a professional! 👍🤣 It happens and what meetings are for
17th Mar 2024, 7:22 PM
Sam
+ 2
Thank you Rain, That’s a very useful tip👍
17th Mar 2024, 11:19 PM
Clara
+ 1
Thnk
19th Mar 2024, 1:03 AM
Anish Kamble
Anish Kamble - avatar
0
How to start creating project i don't now how to right code
18th Mar 2024, 6:48 PM
Anish Kamble
Anish Kamble - avatar
0
Anish Kamble , How to write your own code on Sololearn: [] Go to Create. [] Be in the Code tab. [] Click new (floating circle with + on it). [] Choose Python (or any language). [] Land in the playground (editor) [] Write some code. [] Run it. [] Save it. [] Exit the editor. [] Land in the Code tab again. [] Change "Hot Today" to "My Code Bits". [] See the code you just saved. [] Later codes get added there too.
18th Mar 2024, 10:27 PM
Rain
Rain - avatar