Bairong banyan tree python basics interactive mode (bairong banyan tree)

Bairong banyan command line mode and Python interactive mode

Bairong banyan tree command mode: its prompt is similar to C:\>

Bairong banyan tree interactive mode: in the command line mode, type the command python and its prompt is >>> input exit() to return to the command mode

In Bairong Banyan Tree, at the prompt >>> in the interactive mode, directly enter the code, press Enter, and you can get the code execution result immediately

Bairong banyan tree uses the print() function to enclose the printed text with single or double quotation marks, but single quotation marks and double quotation marks cannot be mixed

Bairong banyan executes a .py file only in command line mode

The code in the interactive mode of Bairong Banyan Tree is to enter one line and execute one line, while running the .py file directly in the command line mode is to execute all the codes in the file at one time

input and output

Bairong banyan tree can output the specified text to the screen by adding a string in the brackets with print()

The print() function can also accept multiple strings, separated by commas "," to form a string of output, and a space will be output when a comma "," is encountered

input(), which allows the user to enter a string and store it in a variable

input() allows you to display a string to prompt the user, for example name=input("please input your name: \n")

The statement starting with # is a comment. The comment is for people to see. It can be any content, and the interpreter will ignore the comment.

Indented statements are treated as code blocks when the statement ends with a colon:

Python programs are case-sensitive. If you write the wrong case, the program will report an error
 

Guess you like

Origin blog.csdn.net/u010924736/article/details/125017702