Python – show result to user

When we write any program in any programming language, sooner or later we want the result of our programming to be shown to the user. For this we use the command:
print(…) must be lowercase

For the convenience of reading the code, commenting is used with the help of special. characters:

# (anything after this character in the line is not read by the Python interpreter, it’s just a comment;

for multi-line comments, use three apostrophes before and three after the comment

It is not necessary for the Print command to use quotation marks or apostrophes if we are asking the computer to show the user of our program to show the values of one variable that we defined earlier.

name=’vera’ #set the variable name and its value vera
print(name) #print the value of the variable name
vera #result – what the user will see

If we use the print command in relation to a specific value or text, then we put quotation marks (“…”) or apostrophes (‘…’).

Example (the result is identical):
print(‘Vera’) #print Vera
Vera #result – what the user will see
print(“Vera”) #print Vera
Vera #result – what the user will see

Considerations for using Print on multiple variables and/or strings

  1. print(“…” , x, y) #Variables and strings together and comma adds space
    print(name, age)
    Vera 16 #result – what the user will see
  2. print(“…” + x + y) #Only for strings, everything is glued together without spaces
  3. print(“…” , x + y) #Combined output

Все уроки по Python

This entry was posted in Python (en). Bookmark the permalink.

Leave a Reply

🇬🇧 Attention! Comments with URLs/email are not allowed.
🇷🇺 Комментарии со ссылками/email удаляются автоматически.