816 B
816 B
type, title, xp, duration, difficulty
| type | title | xp | duration | difficulty |
|---|---|---|---|---|
| challenge | The Translator | 50 | 25 | 2 |
The Translator
[INCOMING — Mission Control, Earth]
Cadet, when input comes in as text (a
str), you can't do math with it directly. You have to translate it to a number.Three converters:
int("42")→42float("3.14")→3.14str(42)→"42"Implement
years_until(age)that returns100 - ageas anint. The argument may arrive as eitherintorstr— handle both by callingint()on it first.[END TRANSMISSION]
Your Task
Open starter/starter.py. Convert age with int(), then return
100 - age.
Objectives
years_until(25)returns75years_until("25")also returns75(handles string input)- Works for any integer age 0–100