python learning the first day (day9)

First, the entire contents of review: basic, basic data types, functions, and object-oriented

       Design development is greater than the true

        Encoding: the machine can be directly recognized language

        Bytecode: generating high-level language bytecode Cpython e.g., the need for internal language into machine code

1 python environment variable configuration

1.1 Configuration Environment Variables

Properties - Advanced - environment variables, among the plurality of environment variables; partition

Configuration environment variable effect: after the path environment variable added, when the terminal performs not enter the full path

2 variables

2.1 Variable names on behalf of that value, the value may be changed

      Composition: letters, numbers, underscores, and the data can not begin

2.1 Variable names Notes

       1) Python keywords not be used as a variable name, for example: as \ break \ continue \ class \ def \ del \ else \ as \ except \ and ........

       2) the variable name is not the same thing and Python built (Example: built-in methods, built-in class)

       3) Naming the best variable name has meaning, easy to understand code reader, for example: user_id, Java language hump pay attention, for example: usr the I d

       4) single-line comment with #, multi-line comment with the quotation marks "" "............" ""

3 inpput usage

   input = waits until the user enters values

Example: user_id = input ( '' Please enter a user name)

4 Basic Data Type: String \ Digital

4.1 string: quotation marks content, called string

      String contains algorithms: + addition, multiplication *

4.1.1 Examples

n1="Tony"

n2="18"

n3 = n1 + n2

print n3

n4=n1*n2

n5 = n1 * 3 ------ n5 is equal to three times repeated n1, n5 = TonyTonyTony

4.2 Digital: no quotation marks figures

     Algorithm for Digital included: + plus, minus -, * multiplication, addition //, a power of **% to get the remainder division, dividing the quotient taken //

4.2.1 Examples

A determination is odd or even

a=13

temp=a%2

if temp==0

   print ( "a is an even number")

else:

      print ( "a is an odd number")

 

5 condition if \ else \ elif \ if nested \ whlie

5.1 indented code block to be consistent

Guess you like

Origin www.cnblogs.com/xucuiqing/p/11444413.html