Contents
How to make a dictionary:
names =
{
"name": "James",
"name:, "Barry",
"name:, "Sarah",
"name", "Amanda"
}
Looping over these elements, keys they are called.
peoples =
{
"name": "James",
"name:, "Barry",
"name:, "Sarah",
"name", "Amanda"
}
for keys in people:
print peoples[keys]
How to divide in python
a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
for something in a:
if something % 2 == 0:
print something
Lists and functions example in python
def count_small(numbers):
total = 0
for n in numbers:
if n < 10:
total = total + 1
return total
lotto = [4, 8, 15, 16, 23, 42]
small = count_small(lotto)
print small