The first Python program

Source: Internet
Author: User

First create a. py file

Write code in three ways:

Terminal CD desktop Python file path. py;
Terminal Python enter write code;
In the Pycharm;

Order of execution of the program: from top to bottom, from left to right

The place where the program runs results is generally called the console

In Python, the output statement is printed in print (), and only the numbers, characters and letters, and special symbols must be placed in double or single quotation marks (this does not tangle, single and double quotes are not affected), the contents of the quotation marks are output in the console as is.

Input statements are expressed in input () to obtain what the user has entered in the console

Note: The data obtained by input () is a string

Comments can help us to read the code more quickly when we write the code, so it's a good habit to develop annotations.

The role of annotations:

1, comments on your code;

2. Troubleshooting

Note: The contents of the comment are not performed

Single-line comment: Shortcut key ctrl+/(you can also select multiple lines of comment)

Multi-line Comment (block comment, document comment): "Content of the comment" or "" "Comment" "

The first Python program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.