🐸

String Power

Python Basicspython-basics-06-string-power
Reward: 50 XP
|

Combining Spells

Hoppy wants to combine two words into a sentence. We can use the + symbol for this, just like math!

String Concatenation

first = "Super"
last = "Hoppy"
name = first + last
print(name)  # Result: "SuperHoppy"

Notice there is no space? Computers do exactly what you tell them. If you want a space, you must add it.

name = first + " " + last  # Result: "Super Hoppy"

Your Mission

1
Combine

Create a variable full_name by combining "Hoppy" and "Frog".

2
Add Space

Make sure there is a space between them: "Hoppy Frog".

3
Print

Print full_name.

Suggested Solution
Click to expand
full_name = "Hoppy" + " " + "Frog"
print(full_name)
Advanced Tips
Want more? Click to expand

You can also multiply strings! Try multiplying a string by a number.

print("Ha" * 3)

What do you think happens? It prints "HaHaHa"!

pymain.py
Loading...
Terminal
Terminal
Ready to run...