Fitness goal task intro to python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

6th Aug 2023, 7:28 AM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
16 Answers
6th Aug 2023, 8:54 AM
Riya
Riya - avatar
+ 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
6th Aug 2023, 7:53 AM
Riya
Riya - avatar
+ 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...??
6th Aug 2023, 8:17 AM
Riya
Riya - avatar
+ 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)
6th Aug 2023, 7:33 PM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
+ 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.
10th Sep 2023, 2:40 PM
Wes
+ 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.
15th Oct 2023, 6:43 AM
John
John - avatar
+ 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)
6th Aug 2023, 8:14 AM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
+ 1
I ran the code and it works
7th Aug 2023, 8:37 PM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
0
It still does not work
6th Aug 2023, 8:15 AM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
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.
6th Aug 2023, 8:32 AM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
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
6th Aug 2023, 8:38 AM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
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
7th Aug 2023, 9:16 PM
Eaz Mahodi Sagor
Eaz Mahodi Sagor - avatar
0
Kim Hammar-Milliner ok i understand it was my mistake to input.
7th Aug 2023, 9:39 PM
Eaz Mahodi Sagor
Eaz Mahodi Sagor - avatar
0
Tast 3 failed?
26th Sep 2023, 6:11 PM
SK
SK - avatar
0
I fixed it
27th Sep 2023, 12:51 AM
Kim Hammar-Milliner
Kim Hammar-Milliner - avatar
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.....
1st Mar 2024, 5:29 AM
Demilade Howells
Demilade Howells - avatar