

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Variables
incomplete
2: Variables Vary
incomplete
3: Math
incomplete
4: Negative Numbers
incomplete
5: Comments
incomplete
6: Variable Names
incomplete
7: Basic Variable Types
incomplete
8: F-Strings in Python
incomplete
9: NoneType Variables
incomplete
10: NoneType Quiz
incomplete
11: Dynamic Typing
incomplete
12: Math With Strings
incomplete
13: Multi-Variable Declaration
incomplete
14: Boots
incomplete
15: Spellbook
incomplete
16: Character Report
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Have you ever played old-school Pokemon and chosen a funny name so that the in-game messages would come out funny?
In Python, we can create strings that contain dynamic values with the f-string syntax.
num_bananas = 10
bananas = f"You have {num_bananas} bananas"
print(bananas)
# You have 10 bananas
f to the start of quotes to create an f-string: f"this is easy!"{} around a variable to interpolate (put) its value into the string.You can also use an f-string directly inside a print() call, without assigning it to a variable first. It's just a string – don't overthink it!
Fix the bug on line 7. Use an f-string to inject the dynamic values into the string:
NAME with the value of the name variableRACE with the value of the race variableAGE with the value of the age variableDo not "hard-code" the values into the string. For example, this is not the solution we're looking for (even though it happens to work in this case):
print("Yarl is a dwarf who is 37 years old.")
We need the player to see their values.
Punctuation and capitalization matters! Make sure your output matches the expected output exactly.