Lesson02

Run Settings
LanguagePython
Language Version
Run Command
i = 0 i= i +1 def a(): y=1 print("I am form function a", i, y) return b def b(): # i=i+1 print("I am form function b") return a a()()()()()()()()()() x= [1,[2],3] print (x , id(x)) x[0] =x[1] print(x , id(x)) x[0] =x[0] +x[1] print (x, id(x)) y=[[1], [2], [3]] y[0]=y[0] +y[1] print (y, id(y)) y=y+x print(y, id(y)) z=1,2 u=3,4 print(z[0], id(z), z) z = z + u print(id(u), u, id(z), z) def a(): print("a") def b(): print('b') v= a,b a=10 #x[0]() print (v) from fractions import Fraction #example float number float_num = 0.755 #convert float to fraction fraction = Fraction(float_num).limit_denominator() fraction1 = Fraction(float_num) print(fraction, fraction1, id(fraction), id(fraction1)) v=(True) _v="c" #internal use __v='尸木日' #use for class _v_ = 'ca' #dundan for python system internal use # this is comment print (id(1), id(True)) x=1/3 print (id(x), x ) x=1/3+ 1/3+ 1/3 print(id(x), x, (x), id(v), v) x=0.1 +0.1 +0.1 print(id(x), x, (x), id(v), v) '''耿景瘁 fsdhfkjhag fasjk ''' v="sey" print(id(v), v , id("sey")) x = 0x01 #hex print(id(x), x, id(1)) y=3 print(id(y), y, id(3)) z=1 + 2 print(id(z), z, id(5)) print(id(1.0), id(1.01), id(0.01)) u=(1,2,33) #Tuples cannot modify value print(id(u), u, id(1), id(2), id(33)) print(int(5/3)) print(5//3) print((5/3)) print((5.99999/3)) print((5//3.0)) print(type(5.99999/3)) print(-7%3) print(-7/3) print(7**3)
Editor Settings
Theme
Key bindings
Full width
Lines