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