String Concantation

name = input("What is your name? ")
print(f"Hello!, {name}!)

In line 2 of the code above is called an f string it used to display variables in a sentence.

In order to use that you must put a f behind the quotes and place a variable in between curly brackets to display variables

If you want a better understanding of how String Concantation works then click the link below to watch a video about String Concantation in Python

https://youtu.be/so-iBY56Psw?si=KA_VdbSrZ0KFgDbr Next

Challenge (optional)

Make a program that asks the user for their age and then print a mesage saying "You are {age} years old

r


⏳ Loading...