Python Foundation One

Source: Internet
Author: User

First, Introduction

The Python section is based on Python3

Print ("Hello world!")

Second, the variable

Python does not have the concept of constants, everything can be variables, but the habitual use of all uppercase characters to represent constants, such asAGE_OF_RAP = 56

Variable refers to the amount of variation that can be used to refer to the contents of an address stored in memory. There are the following rules:

1. Variable names can only be any combination of letters, numbers, or underscores

2. The first character of a variable name cannot be a number

3. The following keywords cannot be declared as variable names [' and ', ' as ', ' assert ', ' Break ', ' class ', ' Continue ', ' Def ', ' del ', ' elif ', ' Else ', ' except ', ' exec ', ' FINA Lly ', ' for ', ' from ', ' global ', ' if ', ' import ', ' in ', ' was ', ' lambda ', ' not ', ' or ', ' pass ', ' print ', ' raise ', ' return ', ' try ', ' while ', ' with ', ' yield ']

Three, string

A string is one of the python underlying data types, consisting of either single or double quotation marks, such as ' I love python ' or ' I love Python ', which is immutable and therefore cannot be modified once established

Four, read user input

Python3 deprecated Raw_input (), only input () is used to read the user's inputs

Name = input ("what isyour name? ") ")

V. List

One of the important basic data types

List1 = ['physics'chemistry', 1997, += [1, 2, 3, 4, 5= ["a""b""C"  "D"]

VI. Dictionary

One of the important basic data types

' ABC ': 456'abc': 123, 98.6:37}

Seven, Process Control

x = Int (input ("Please enter your total score:"))ifX >= 90:    Print('Excellent')elifX>=80:    Print('Liang')elifX >= 70:    Print('in')elifX >= 60:    Print('qualified')Else:    Print('not qualified')

Eight, circulation

# !/usr/bin/python  = 0 while count < 9:   print'thecount is:'  , Count   print"good bye! "

Python Foundation One

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.