-
Notifications
You must be signed in to change notification settings - Fork 0
0. Tutorial
Kamal Banga edited this page Oct 1, 2018
·
11 revisions
#ToDo Installation & Setup
Print 0 to 9
>>> [i for i in range(10)])
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> list(range(10))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> for i in range(10):
print(i)
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
range(n)
object gives a list from 0
to n
Print even numbers in 0 to 9
[i for i in range(10) if i % 2 == 0]
Print squares of all numbers in 0 to 9
[i*i for i in range(10)]
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
- Dynamically-typed
- Arrays are lists.
- Has great data structures built-in: sets and dictionaries (key-value map, associative array)
This section is a stub, please move on to Reference