Solution: About You
Explore how to use variables in Python to store information like names and ages, then print them together in a sentence. Learn how Python handles text and numbers with the print function to create interactive outputs.
We'll cover the following...
We'll cover the following...
In this example, we’re teaching Python to remember information using variables, and then print that information together in a sentence.
name = "Alex"age = 22print("Hi, my name is", name, "and I’m", age, "years old.")
name = "Alex"stores the text"Alex"in a variable calledname.age = 22stores the number22in a variable calledage.The
print()function displays the message.Inside
print(), we use commas to separate text and variables, Python automatically adds spaces between them.