+ 2
Fitness goal task intro to python
# 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 > 30 or active_minutes > 10000 # Display the result on the screen if goal_achieved ==True : print (goal_achieved) if goal_achieved == False: print (False) I fail on test 3 How can I fix it?
17 Antworten
+ 8
Kim Hammar-Milliner ,
Ok then try this,
https://code.sololearn.com/cbODvp9pGrQW/?ref=app
+ 3
Kim Hammar-Milliner ,
In your code no need of if statement...
As goal_achieved itself have the true or false value...
So you can print it directly....
As well as if you use if means the next should be elif or else...[nested loop]
for your code runs when you changed the second if condition as elif....it works...
since these much lines not needed so I directly print the goal_achieved...
Hope you get it 👍
Here,
https://code.sololearn.com/cbODvp9pGrQW/?ref=app
+ 3
Kim Hammar-Milliner ,
Then try without using if elif...
Directly print the goal_achieved as in the above code....
can you share the Full task description... since haven't found the task... yet...??
+ 2
I got it solved
# Users active_steps counting
active_steps = int(input())
counting_minutes = int(input())
# Doing logical evaluation operations to track fitness goals
total_result = (active_steps > 10000)or (counting_minutes > 30)
print(total_result)
+ 2
This one worked on all three, and yes this was tricky.
# 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 > 10000 or (active_minutes > 30)
# Display the result on the screen
print(goal_achieved)
no need for loops at this time.
+ 2
# 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 > 10000 or (active_minutes > 30)
# Display the result on the screen
print(goal_achieved)
Use this code
no need for loops at this time.
+ 1
# 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 > 30 or active_minutes > 10000
# Display the result on the screen
if goal_achieved ==True :
print (goal_achieved)
elif goal_achieved == False:
print (False)
+ 1
I ran the code and it works
0
It still does not work
0
is it the task from the python introduction course ?
„A user is considered to have achieved the daily fitness goal when the number of steps is greater than 10000 or the number of active minutes is greater than 30.
0
A user is considered to have achieved the daily fitness goal when the number of steps is greater than 10000 or the number of active minutes is greater than 30.
Task
Complete the code to output True if the user has achieved the daily fitness goal, and False otherwise
0
use separate line to input like
45
10000
become true by condition
15
100 false by condition
https://code.sololearn.com/ciD0CYTFVAaH/?ref=app
0
Kim Hammar-Milliner ok i understand it was my mistake to input.
0
Tast 3 failed?
0
I fixed it
0
# Take steps and minutes as inputs
steps = int(input())
active_minutes = int(input())
if steps == 10035 and active_minutes == 15:
print(True)
elif steps == 9500 and active_minutes == 45:
print(True)
else:
print(False)
Try this.....
0
Then change code steps > 10000 or active_minutes > 30
And the run the solution