Python Learning-1

Source: Internet
Author: User

First, Introduction

With the development of the Internet, different programming languages have changed, the application of Python language is more common, so I have to learn it.

Learning version: python3.0

Plugin: Pycharm

Second, the content

2.1 Variables

Format: Variable name = assigned value

Example: Age = 23

Data type

Digital type: Int (integer), float (floating point type)

Text type: string (String)

BYTE type: Binary

Logic type: "Yes/no" "On/Off"

2.2 Python text annotations

#: Single line comment

'/' "": Single and double quotes are multiline comments

    

2.3 User interaction

2.3.1 Let the user enter with input

Format: input (' cue phrase ')

    

2.3.2 The password entered is not visible, you need to reference the library file Getpass

    

2.4 There are two ways to print multiple lines of information

2.4.1

    

2.4.2

    

2.5 If statement

Format:

If condition:

Content

Elif Conditions:

Content

Else

Content

2.6 While statement

Format: While condition:

Content

Else

Content

    

The difference between 2.7 break and continue

Break: End this cycle

Continue: Jump out of this loop for the next loop

III. Preparation of the procedure

1. Guess the age of a person and have three chances. After guessing three times after the line continue to guess, enter to continue to guess, do not want to guess the end of input n.

  

    

    

    

    

Python Learning-1

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.