PieceOfAPie
PieceOfAPie
  • Home
  • Tutorials
  • More
    • Home
    • Tutorials
  • Home
  • Tutorials

Prints

Previous Lesson 


In Python, you can ask the computer to display a message on the screen. You can display many things like variables, strings, integers, and much more. An example is shown below. 

  • Example


As you can see, when printing something, you have certain rules. In each and every print statement, you have to type print, followed by parentheses which contains what you are printing.

  • print(Term)

You can also print a new line like so:

  • print("\n")

 

Inputs

 In Python, you can make a program that allows the computer to ask a question which the person using the program (user) will be able to answer. You can also store that answer in a variable. This is an example of the input without the variable.

  •  Without Variable


This is an example with the variable.

  •  With Variable


You can even use that stored answer later on.

  •  Using Variable

 

Concatenation

 

In Python, you can combine two or more different elements into a single print statement. This is useful if you want to use variables in print statements.

  •  Example 


Be sure to use spaces wisely while doing this. You don’t want the output to be like this.

  • HelloJohn!

Prints, Inputs, and Concatenation Exercise

 Write a short interview using prints, inputs, and concatenation in Python. 

Next Lesson

If Conditions

Copyright © 2024 PieceOfAPie - All Rights Reserved.

Powered by GoDaddy

This website uses cookies.

We use cookies to analyze website traffic and optimize your website experience. By accepting our use of cookies, your data will be aggregated with all other user data.

Accept