Article Mini projects
Base 6 Number System in Python
…numpy as np # numpy.base_repr(number, base) returns a string print(np.base_repr(12, 6)) # Output: 20 print(np.base_repr(36, 6)) # Output: 100 print(np.base_repr(101, 6)) # Output: 245…
2 results
Article Mini projects
…numpy as np # numpy.base_repr(number, base) returns a string print(np.base_repr(12, 6)) # Output: 20 print(np.base_repr(36, 6)) # Output: 100 print(np.base_repr(101, 6)) # Output: 245…
Article Python Fundamentals
…You can also describe a function with a docstring , a string in triple quotes placed right under the def line: def weight_on_planet(earth_weight, gravity=0.38): """Return what something would weigh on…