Python Web - L02

Run Settings
LanguagePython
Language Version
Run Command
t = 1,2,3 print(type(t),t) t = 1, # single tuple print(type(t),t) t = (1) print(type(t),t) t = tuple() #create empty tuple using tuple function print(type(t),t) t = () #danger using () to create tuple print(type(t),t) l = [1,2,3] l.append(4) print(l) #t.append(4) # In this case, we cannot use append function with tuple t = tuple(l) # List changes to Tuple print(t) t = 1,2,3,4,5,6 l = list(t) # Tuple changes to List print(l) def a(): x = 1 y = 2 print(x,y) a() a() print(a()) # print value firstly, and then print return value = None def a(): x = 1 y = 2 return x, y y = a() print(type(y), y) def a(x, y): return x + y y = a(1,2) print(type(y), y) y = a(1,2) + a(3,4) print(type(y), y) def a(x, y): # this is function a# print(x,y) # @1.5 x=1, y=2 x1 = x # define x with value 1 y1 = y # define y with value 2 print(x1, y1) return x1 + y1 a(1,2) print(a) print(a(1,2) + a(3,4)) # print(3 + a(3,4) print(3+7) print(10))
Editor Settings
Theme
Key bindings
Full width
Lines