Wednesday, February 28, 2024

 

Concatenate more than one input variable including other print function content.

All it really means is combine text (remember, text is called a string) and variables together into single sentences!

Here is the code to concatenate .

myName = input("What's your name? ")
myLunch = input("What are you having for lunch? ")
print(myName, "is going to be chowing down on", myLunch, "very soon!")

  • It turns out print has a super-power. We can give it as many different things to print as we want. All we need to do is put a comma( ,) between every different thing in the ().



No comments:

Post a Comment

  2D Dictionaries Remember that dictionaries are very similar to lists, except that they store data as key:value pairs. The value is what it...