PI. Fibonacci, first implementation

Run Settings
LanguagePython
Language Version
Run Command
# Function definition is pretty simple, cause it starts from `def`. # n - here is an argument, it's a value function needs to operate. # Unlike C/C++ or Java you do not specify argument type, just name. # The string under line with function is a doc-string which describes # functionality and give brief overview. def fib(n): """Print a Fibonacci series up to ``n``""" # Nothing non-pythonical, it's just a shorthand for: # a = 0 # b = 1 a, b = 0, 1 while a < n: # @WARNING: Brain damage possible # Please be careful with this coma, it's not rare, but important. # Without it python will stop thinking of expression as of tuple, # because not it's similar to: # print( (a, None) ) # As far as None loves to appears as nothing and elements of tuples # prints out seperated with space, then you can consider that this is # the sortest way to print empty space. print a, # As above, this is just simultanius exchange of values, but... # It bettwer describe as: # a1 = b # b1 = a + b # a = a1 # b = b1 a, b = b, a + b fib(100)
Editor Settings
Theme
Key bindings
Full width
Lines