Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Tracking Step Goal Progress with if-else Statements | Mastering Python if-else Statements
Conditional Statements in Python
course content

Kurssisisältö

Conditional Statements in Python

Conditional Statements in Python

1. Mastering Python if Statements
2. Mastering Python if-else Statements
3. Mastering Python if-elif-else Statements

book
Challenge: Tracking Step Goal Progress with if-else Statements

Tehtävä

Swipe to start coding

Your fitness tracker calculates how far the user is from their step goal. If the user has taken more than 90% of their step goal, display a congratulatory message. Otherwise, show how many steps are left to reach the goal.

  • To compare if the user has reached 90% of the step goal, use step_goal * 0.9 to calculate 90% of the goal.
  • If condition is met, set result_more_than_90 to True.
  • Otherwise, the remaining steps should be calculated.
  • All print statements here are for testing your code.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 2
toggle bottom row

book
Challenge: Tracking Step Goal Progress with if-else Statements

Tehtävä

Swipe to start coding

Your fitness tracker calculates how far the user is from their step goal. If the user has taken more than 90% of their step goal, display a congratulatory message. Otherwise, show how many steps are left to reach the goal.

  • To compare if the user has reached 90% of the step goal, use step_goal * 0.9 to calculate 90% of the goal.
  • If condition is met, set result_more_than_90 to True.
  • Otherwise, the remaining steps should be calculated.
  • All print statements here are for testing your code.

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 2
Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Pahoittelemme, että jotain meni pieleen. Mitä tapahtui?
some-alt