Python Introductory Learning--statements, getting user input, functions

Source: Internet
Author: User

1. Statements

What is the difference between a 1.1 statement and an expression? An expression is something, and the statement is doing something (that is, telling the computer what to do). For example, 2*2 is 4, while print2*2 prints 4.

1.2 If statement

When the condition is false, nothing happens; when the condition is true, the subsequent statement (for the print statement) is executed. Note: Using the IF statement within the interactive interpreter requires a two-time carriage return and the IF statement executes

2. Get user input

The statement after the Python prompt (>>>) can be counted as part of a complete program, the value entered is provided by the user, and the program prints the product of the two number of inputs 1428. When writing a program, you do not need to know what number the user has entered.

3. Functions

Functions, like small programs, can be used to implement specific functions. Python has many functions, such as the standard functions such as POW, which are called built-in functions, or you can customize functions. The way to use a function is called a call function. Because a value is returned, a function call can be simply considered as a different expression. We can use a combination of function calls and operators to create more complex expressions:

Python Introductory Learning--statements, getting user input, functions

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.