Python basic programming Getting Started

Python Quick Start:

         Line continuation character \,

                   Note, not space after the line continuation character, must be directly wrap

         Reserved words:

                   Note three: True False None, they are three

        

         Data Type: 9 kinds of cores:

                   Numeric types: integers, floating point numbers, complex numbers

                   Byte type: strings, byte strings

                   Combination Type: collection of tuples, lists, dictionaries

        

         Assignment and branch statement:

                   Assignment of synchronous assignment,

                            a, b = b, a and b can be realized a switching

        

         O Python programs:

                   input () return value is a string

                  

                   print () usage:

                            First: print ( "At this string") # default line break

                            Second: a plurality of output variables,

                                     print("asdf" ,"jkl")

                                     Then leave a space between the variable

                            Third Usage: mixing output

                                     echo="A"

                                     print ( "{} which is an output variable" .format (echo)

                   String format method:

                            .format () the front groove string

                            % (Arg) has a flag in front of the string

                   Echo program: # minimum input-output program

                            print(input())

                   Evaluation function eval:

                            It is used to remove both quotes

. 1  # the Author: ZCB 
2 temperature = INPUT ( " temperature value with the Enter a symbol: >>> " )
 . 3 TEMP = the eval (temperature [: -. 1 ])
 . 4  IF temperature [-1] in [ ' C ' , ' C ' ]:
 . 5      F. = 32 + 1.8 * TEMP
 . 6      Print ( " temperature is converted {:} F. .2f " .format (F.))
 . 7  elif temperature [-1] in [ ' F ' , ' F. ' ]:
 . 8     = C (TEMP-32) /1.8
 . 9      Print ( " temperature is converted {:} .2f C " .format (C))
 10  the else :
 . 11      Print ( " input format error " )
Temperature conversion examples

 

Guess you like

Origin www.cnblogs.com/zach0812/p/11259397.html