Today in office I learned some basic data type "List" &"Tuple" , "Dict" &“set"
List is easy to understand and we used a lot in Java and you can get List(-1) which is pretty interesting and I think we seldom use before
And it is flexible you can put List in List and get a element by using List[0][2]
There is no duplicated value in set
In order to write a English dialog more smoothly I googled some English docs and find something more about List
** operator to calculate powers
https://docs.python.org/3/tutorial/introduction.html#lists>>> 2**7 # 2 to the power of 7 which is 128
We can also do some calculation and let the game start
a,b = 0,1
while a <20 :
print ('a=', a)
a,b = b, a+b
print(' b=' , b)
end can be used to avoid the newline after the output
so we can change it to print('b=' , b, end=';')
after that we can define a function and put everything above in it
def cauculate(a,b) :
There are many argument values you can put in the function
网友评论