# Notebook from veronica1013/project_dsp
Path: aloha.ipynb

message = "Good Morning!"
print(message)Good Morning!
message = "Hello Mum"
print(message)Hello Mum
a = "I miss you alot!"
b = "I am dedicating this course to you."
c = "I know you will be proud."
print(("Hi mum,"), (a), (b), (c))
Hi mum, I miss you alot! I am dedicating this course to you. I know you will be proud.
d = f"{a} {b} {c}"
print(("Hi mum,"), (d))Hi mum, I miss you alot! I am dedicating this course to you. I know you will be proud.
print(f"Hi mum, {d}")Hi mum, I miss you alot! I am dedicating this course to you. I know you will be proud.
message_2 = "Hello Python Crash Course reader!"
print(message_2)Hello Python Crash Course reader!
name = "ada lovelace"
print(name.title())Ada Lovelace
print(name.upper())
print(name.lower())ADA LOVELACE
ada lovelace
#Using f-strings in a variable
first_name = "ada"
second_name = "lovelace"
full_name = f"{first_name} {second_name}!"
print(full_name.title())Ada Lovelace!
print(f"Hello, {full_name.title()}!")Hello, Ada Lovelace!!
message_3 = f"Hello, {full_name.title()}!"
print(message_3)Hello, Ada Lovelace!!
# To add a tab to your text, use \t such as shown below
d = f"{a} \t{b} \t{c}"
print(("Hi mum,"), (d))Hi mum, I miss you alot! 	I am dedicating this course to you. 	I know you will be proud.
# To add a tab to your text, use \t, then use \n to start in a new line
# use \n then \t
d = f"{a} \n\t{b} \n\t{c}"
print(("Hi mum,"), (d))
Hi mum, I miss you alot!
	I am dedicating this course to you.
	I know you will be proud.
# Use rstrip() to remove whitespaces
favourite_language = "python "
favourite_language
_____no_output_____favourite_language.rstrip()
_____no_output_____#when you call favourite language again, it will bring output with the white space
favourite_language_____no_output_____#To remove the whitspaces completely, associate the stripped value with the variable name
favourite_language = favourite_language.rstrip()
#The whitespaces is completely removed
favourite_language
_____no_output_____#To remove whitespaces from the left of a value, use lsrtip()
favourite_language1 = " python"
favourite_language1.rstrip()
_____no_output_____favourite_language1 = " python"
favourite_language1.lstrip()_____no_output_____#To remove whitespaces from both sides use the strip()
favourite_language2 = " python "
favourite_language2 = favourite_language2.strip()
favourite_language2_____no_output_____

#### How to use apostrophies in a string_____no_output_____

message_4 = "One of python's strengths is its diverse community"
message_4_____no_output_____print(message_4)One of python's strengths is its diverse community
#When single quote is used, you get invalid syntax
message_5 = 'One of python's strengths is its diverse community'
print(message_5)_____no_output_____Name = 'Brother'
Message_6 = 'Would you like to learn some Python today?'
print(f"Hi {Name}, {Message_6.lower()}")Hi Brother, would you like to learn some python today?
Name.upper()_____no_output_____print(Name.upper())BROTHER
print(Name.title())Brother
print(Name.lower())brother
quote = '"A person who never made a mistake never tried anything new."'
print(f"Albert Einstein once said, {quote}")Albert Einstein once said, "A person who never made a mistake never tried anything new."
quote1 = '"A person who never made a mistake never tried anything new."'
author = "Albert Einstein"
print(f"{author} once said, {quote}")Albert Einstein once said, "A person who never made a mistake never tried anything new."
quote1 = '"A person who never made a mistake never tried anything new."'
famous_person = "Albert Einstein"
message_7 = f"{famous_person} once said, {quote}"
print(message_7)
print()Albert Einstein once said, "A person who never made a mistake never tried anything new."

name = " veronica "
name = name.rstrip()
name_____no_output_____name = " veronica "
name = name.lstrip()
name_____no_output_____name = " veronica "
name = name.strip()
name_____no_output_____name2 = " veronica isiaho "
#name2 = (' veronica', \n\t'isiaho ').rstrip()
name2.strip()_____no_output_____first_name = "veronica "
second_name = " isiaho"
print(f"1. My first name is: \n\t{first_name.title().rstrip()} \n2. My second name is: \n\t{second_name.title().lstrip()}")1. My first name is:
	Veronica
2. My second name is:
	Isiaho
3**2
_____no_output_____2+3*4_____no_output_____

#### Use parenthesis to order your operation_____no_output_____

(2+3)*4_____no_output_____0.1 + 0.1_____no_output_____0.2 + 0.2_____no_output_____

#### Be aware of arbitrary numbers of decimal places as shown below_____no_output_____

0.2 + 0.1_____no_output_____3 * 0.1_____no_output_____

#### Float is the output for dividing any two integers _____no_output_____

4/2_____no_output_____

#### Mixing a foat and an integer the result is a float_____no_output_____

1 + 2.0_____no_output_____

#### Assigning values to more than one variable using a single line_____no_output_____

x, y, z = 0, 0, 0
print(x, y, z)0 0 0

#### Capital letters are used when a constant value needs to be maintained and bever be changed_____no_output_____

# have the name of your constant value to be in capital letters
MAX_CONNECIONS = 5000_____no_output_____print(5+3)8
print(16-8)8
print(24/3)8.0
print(4*2)8
FAVOURITE_NUMBER = 7
message_8 = "My favourite number is: "
print(f"{message_8} {FAVOURITE_NUMBER}")My favourite number is:  7
FAVOURITE_NUMBER = 7
message_8a = f"My favourite number is: {FAVOURITE_NUMBER}"
print(message_8a)My favourite number is: 7

#### Working with lists_____no_output_____

bicycles = ['trek', 'cannondale', 'redine', 'specialized']
bicycles_____no_output_____# Accessing individual items in a list
print(bicycles[0].title())Trek
#Access the fourth item by requesting the item at index 3
print(bicycles[3].title())Specialized
#Access the last item by using index -1
print(bicycles[-1].title())Specialized
message_9 = f"My first bicycle was a {bicycles[-2].title()}."
print(message_9)My first bicycle was a Redine.
names = ['Dad', 'Mum', 'Jess', 'Lawrence']
print(names[0])
print(names[1])
print(names[2])
print(names[3])Dad
Mum
Jess
Lawrence
a = print(names[0])
b = print(names[1])
c = print(names[2])
d = print(names[3])Dad
Mum
Jess
Lawrence
a = names[0]
b = names[1]
c = names[2]
d = names[3]
MESSAGE = "I am happy to hear from you."
e = f"Hi {a}, {MESSAGE} \nHi {b}, {MESSAGE} \nHi {c}, {MESSAGE} \nHi {d}, {MESSAGE}"
#general = f"Hi {a} {b} {c} {d}, {MESSAGE}"
print(e)Hi Dad, I am happy to hear from you.
Hi Mum, I am happy to hear from you.
Hi Jess, I am happy to hear from you.
Hi Lawrence, I am happy to hear from you.
g = f"I would like to own a {bicycles[0].title()}"
print(g)I would like to own a Trek
HAHA = "I would like to own a "
aloha_1 = f"{HAHA} {bicycles[1].title()} \n{HAHA} {bicycles[2].title()}"
print(aloha_1)I would like to own a  Cannondale
I would like to own a  Redine

### Modifying elements in a list_____no_output_____

# It's the same syntax as for accessing elements in a list
bicycles[0] = 'Audi'
print(bicycles)['Audi', 'cannondale', 'redine', 'specialized']
bicycles[0]_____no_output_____# Use append to add elements in a list
bicycles.append('yamaha')
print(bicycles)['Audi', 'cannondale', 'redine', 'specialized', 'yamaha']
#You can start with an empty list then add elements to the list
motorcycles = []
motorcycles.append('honda'.title())
motorcycles.append('suzuki')
motorcycles.append('newzealand')
print(motorcycles)['Honda', 'suzuki', 'newzealand']

### Inserting an element to a list_____no_output_____

# Use insert() to add a new element in any position
# Insert ducati at position 1
# always use an apostrophe while writing a namei.e 'ducati' not ducati
motorcycles.insert(0, 'ducati')
print(motorcycles)['ducati', 'Honda', 'suzuki', 'newzealand']

### Remove an item from a list
_____no_output_____

# use the del to remove an item from a list
del motorcycles[2] #It should remove suzuki
print(motorcycles)
['ducati', 'Honda', 'newzealand']
#Use the pop() when you want to remove the last element from a list use the element again in another list
pencils = ['yellow', 'green', 'orange']
print(pencils)['yellow', 'green', 'orange']
popped_pencil = pencils.pop()
print(popped_pencil)
orange
print(pencils)['yellow', 'green']

### Removing an item without knowing its position_____no_output_____

# Use remove() when you know the value of an item but not the position
pencils.remove('green')
print(pencils)['yellow']
too_expensive = 'newzealand'
motorcycles.remove(too_expensive)
print(f"A {too_expensive.title()} is too expensive for me.")A Newzealand is too expensive for me.

### NOTE: The remove() only deletes the first occurrence of that value. To remove all the values, use a loop to make sure all the occurrences of the value are removed_____no_output_____

invitees = ['sister', 'cousin', 'niece', 'nephew']
a1 = invitees[0].title()
a2 = invitees[1].title()
a3 = invitees[2].title()
a4 = invitees[3].title()
MESSAGE_1b = "kindly come for dinner tomorrow."
print(f"{a1}, {MESSAGE_1b} \n{a2}, {MESSAGE_1b} \n{a3}, {MESSAGE_1b} \n{a4}, {MESSAGE_1b}")Sister, kindly come for dinner tomorrow.
Cousin, kindly come for dinner tomorrow.
Niece, kindly come for dinner tomorrow.
Nephew, kindly come for dinner tomorrow.
invitees_r = 'nephew'
invitees.remove(invitees_r)
print(f"{invitees_r.title()} won't make it for dinner tommorow.")Nephew won't make it for dinner tommorow.
invitees.insert(3, 'neighbor')
print(invitees)['sister', 'cousin', 'niece', 'neighbor']

### Organizing a List Page 43_____no_output_____

# Use sort() method to organize a list permanently
cars = ['bmw', 'audi', 'toyota', 'subaru']
cars.sort()
print(cars)['audi', 'bmw', 'subaru', 'toyota']
# The sorted() function sorts a list but retains the original order
print(f"Here is the original list: \n{cars}")Here is the original list:
['toyota', 'subaru', 'bmw', 'audi']
print(f"Here is the sorted list: \n{sorted(cars)}")Here is the sorted list:
['audi', 'bmw', 'subaru', 'toyota']
cars_1 = sorted(cars) # or use print(sorted(cars))
cars_1_____no_output_____# The sort() function can sort the cars in reverse order
cars.sort(reverse=True)
print(cars)['toyota', 'subaru', 'bmw', 'audi']
#Use reverse() if you want to sort the list permanently in reverse order
#reverse() doesn't order them alphabetically
#It just reverses the order of the list
#Apply the reverse() function on the same list to revert back to the original list
cars.reverse()
print(cars)['audi', 'bmw', 'subaru', 'toyota']
cars.reverse()
print(cars)['toyota', 'subaru', 'bmw', 'audi']
#Use the len() to find the lists length
len(cars)_____no_output_____places = ['uk', 'paris', 'canada', 'usa']
print(places)['uk', 'paris', 'canada', 'usa']
print(sorted(places))
['canada', 'paris', 'uk', 'usa']
print(f"The original places is: \n{places}")The original places is:
['uk', 'paris', 'canada', 'usa']
places.reverse()
print(places)['usa', 'canada', 'paris', 'uk']
places.reverse()
print(places)['uk', 'paris', 'canada', 'usa']
places.sort()
print(places)['canada', 'paris', 'uk', 'usa']
places.sort(reverse=True)
print(places)['usa', 'uk', 'paris', 'canada']

### Working with lists_____no_output_____

#Using for loop to print out each name
magicians = ['alice', 'david', 'carolina']
for magician in magicians:
    print(magician.title())Alice
David
Carolina
magicians = ['alice', 'david', 'carolina']
for magician in magicians:
    print(f"{magician.title()}, that was a great trick!")
    print(f"I can't wait to see your next trick, {magician.title()}.\n")

print("Thank you everyone, that was a great show!")Alice, that was a great trick!
I can't wait to see your next trick, Alice.

David, that was a great trick!
I can't wait to see your next trick, David.

Carolina, that was a great trick!
I can't wait to see your next trick, Carolina.

Thank you everyone, that was a great show!

### Avoiding indentation errors_____no_output_____

#Unnecessarily indentation
#unindent a a code if the action is not supposed to be repeated many times
magicians = ['alice', 'david', 'carolina']
for magician in magicians:
    print(f"{magician.title()}, that was a great trick!")
    print(f"I can't wait to see your next trick, {magician.title()}.\n")

    print("Thank you everyone, that was a great show!")Alice, that was a great trick!
I can't wait to see your next trick, Alice.

Thank you everyone, that was a great show!
David, that was a great trick!
I can't wait to see your next trick, David.

Thank you everyone, that was a great show!
Carolina, that was a great trick!
I can't wait to see your next trick, Carolina.

Thank you everyone, that was a great show!
#Forgetting the colon gives you an invalid syntax
magicians = ['alice', 'david', 'carolina']
for magician in magicians
    print(magician)_____no_output_____pizzas = ['cheese', 'macarroni', 'tomato']
for pizza in pizzas:
    print(pizza.title())Cheese
Macarroni
Tomato
len(pizzas)_____no_output_____pizzas = ['cheese', 'macarroni', 'tomato']
for pizza in pizzas:
    print(f"I like {pizza.title()} pizza.")

print('I really love pizza!')I like Cheese pizza.
I like Macarroni pizza.
I like Tomato pizza.
I really love pizza!

### Making numerical lists using the range function_____no_output_____

for value in range(1, 5):
    print(value)1
2
3
4
#add +1 if keen to print to 5
for value in range(1, 6):
    print(value)1
2
3
4
5
for value in range(6):
    print(value)0
1
2
3
4
5

### Using range() to make a list of numbers_____no_output_____

numbers = list(range(1, 6))
print(numbers)[1, 2, 3, 4, 5]
# use the third value to skip items in a list using the range()
#to print even numbers
even_numbers = list(range(2, 11, 2))
print(even_numbers)[2, 4, 6, 8, 10]
squares = []
for value in range(1, 11):
    square = value**2
    squares.append(square)
print(squares)[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
cubes = []
for value in range(1, 11):
    cube = value**3
    cubes.append(cube)
print(cubes)[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]
# The above can be written more precisely as below
squares = []
for value in range(1, 11):
    squares.append(value**2)
print(squares)[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
digits = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
min(digits)_____no_output_____max(digits)_____no_output_____sum(digits)_____no_output_____

### List comprehension allows you to generate a list with one line of code_____no_output_____

squares = [value**2 for value in range(1, 11)]
print(squares)[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
#Use for loop to print numbers 1 to 20
for value in range(1, 21):
    print(value)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
numbers = list(range(1, 1000001))
print(numbers)97501, 997502, 997503, 997504, 997505, 997506, 997507, 997508, 997509, 997510, 997511, 997512, 997513, 997514, 997515, 997516, 997517, 997518, 997519, 997520, 997521, 997522, 997523, 997524, 997525, 997526, 997527, 997528, 997529, 997530, 997531, 997532, 997533, 997534, 997535, 997536, 997537, 997538, 997539, 997540, 997541, 997542, 997543, 997544, 997545, 997546, 997547, 997548, 997549, 997550, 997551, 997552, 997553, 997554, 997555, 997556, 997557, 997558, 997559, 997560, 997561, 997562, 997563, 997564, 997565, 997566, 997567, 997568, 997569, 997570, 997571, 997572, 997573, 997574, 997575, 997576, 997577, 997578, 997579, 997580, 997581, 997582, 997583, 997584, 997585, 997586, 997587, 997588, 997589, 997590, 997591, 997592, 997593, 997594, 997595, 997596, 997597, 997598, 997599, 997600, 997601, 997602, 997603, 997604, 997605, 997606, 997607, 997608, 997609, 997610, 997611, 997612, 997613, 997614, 997615, 997616, 997617, 997618, 997619, 997620, 997621, 997622, 997623, 997624, 997625, 997626, 997627, 997628, 997629, 997630, 997631, 997632, 997633, 997634, 997635, 997636, 997637, 997638, 997639, 997640, 997641, 997642, 997643, 997644, 997645, 997646, 997647, 997648, 997649, 997650, 997651, 997652, 997653, 997654, 997655, 997656, 997657, 997658, 997659, 997660, 997661, 997662, 997663, 997664, 997665, 997666, 997667, 997668, 997669, 997670, 997671, 997672, 997673, 997674, 997675, 997676, 997677, 997678, 997679, 997680, 997681, 997682, 997683, 997684, 997685, 997686, 997687, 997688, 997689, 997690, 997691, 997692, 997693, 997694, 997695, 997696, 997697, 997698, 997699, 997700, 997701, 997702, 997703, 997704, 997705, 997706, 997707, 997708, 997709, 997710, 997711, 997712, 997713, 997714, 997715, 997716, 997717, 997718, 997719, 997720, 997721, 997722, 997723, 997724, 997725, 997726, 997727, 997728, 997729, 997730, 997731, 997732, 997733, 997734, 997735, 997736, 997737, 997738, 997739, 997740, 997741, 997742, 997743, 997744, 997745, 997746, 997747, 997748, 997749, 997750, 997751, 997752, 997753, 997754, 997755, 997756, 997757, 997758, 997759, 997760, 997761, 997762, 997763, 997764, 997765, 997766, 997767, 997768, 997769, 997770, 997771, 997772, 997773, 997774, 997775, 997776, 997777, 997778, 997779, 997780, 997781, 997782, 997783, 997784, 997785, 997786, 997787, 997788, 997789, 997790, 997791, 997792, 997793, 997794, 997795, 997796, 997797, 997798, 997799, 997800, 997801, 997802, 997803, 997804, 997805, 997806, 997807, 997808, 997809, 997810, 997811, 997812, 997813, 997814, 997815, 997816, 997817, 997818, 997819, 997820, 997821, 997822, 997823, 997824, 997825, 997826, 997827, 997828, 997829, 997830, 997831, 997832, 997833, 997834, 997835, 997836, 997837, 997838, 997839, 997840, 997841, 997842, 997843, 997844, 997845, 997846, 997847, 997848, 997849, 997850, 997851, 997852, 997853, 997854, 997855, 997856, 997857, 997858, 997859, 997860, 997861, 997862, 997863, 997864, 997865, 997866, 997867, 997868, 997869, 997870, 997871, 997872, 997873, 997874, 997875, 997876, 997877, 997878, 997879, 997880, 997881, 997882, 997883, 997884, 997885, 997886, 997887, 997888, 997889, 997890, 997891, 997892, 997893, 997894, 997895, 997896, 997897, 997898, 997899, 997900, 997901, 997902, 997903, 997904, 997905, 997906, 997907, 997908, 997909, 997910, 997911, 997912, 997913, 997914, 997915, 997916, 997917, 997918, 997919, 997920, 997921, 997922, 997923, 997924, 997925, 997926, 997927, 997928, 997929, 997930, 997931, 997932, 997933, 997934, 997935, 997936, 997937, 997938, 997939, 997940, 997941, 997942, 997943, 997944, 997945, 997946, 997947, 997948, 997949, 997950, 997951, 997952, 997953, 997954, 997955, 997956, 997957, 997958, 997959, 997960, 997961, 997962, 997963, 997964, 997965, 997966, 997967, 997968, 997969, 997970, 997971, 997972, 997973, 997974, 997975, 997976, 997977, 997978, 997979, 997980, 997981, 997982, 997983, 997984, 997985, 997986, 997987, 997988, 997989, 997990, 997991, 997992, 997993, 997994, 997995, 997996, 997997, 997998, 997999, 998000, 998001, 998002, 998003, 998004, 998005, 998006, 998007, 998008, 998009, 998010, 998011, 998012, 998013, 998014, 998015, 998016, 998017, 998018, 998019, 998020, 998021, 998022, 998023, 998024, 998025, 998026, 998027, 998028, 998029, 998030, 998031, 998032, 998033, 998034, 998035, 998036, 998037, 998038, 998039, 998040, 998041, 998042, 998043, 998044, 998045, 998046, 998047, 998048, 998049, 998050, 998051, 998052, 998053, 998054, 998055, 998056, 998057, 998058, 998059, 998060, 998061, 998062, 998063, 998064, 998065, 998066, 998067, 998068, 998069, 998070, 998071, 998072, 998073, 998074, 998075, 998076, 998077, 998078, 998079, 998080, 998081, 998082, 998083, 998084, 998085, 998086, 998087, 998088, 998089, 998090, 998091, 998092, 998093, 998094, 998095, 998096, 998097, 998098, 998099, 998100, 998101, 998102, 998103, 998104, 998105, 998106, 998107, 998108, 998109, 998110, 998111, 998112, 998113, 998114, 998115, 998116, 998117, 998118, 998119, 998120, 998121, 998122, 998123, 998124, 998125, 998126, 998127, 998128, 998129, 998130, 998131, 998132, 998133, 998134, 998135, 998136, 998137, 998138, 998139, 998140, 998141, 998142, 998143, 998144, 998145, 998146, 998147, 998148, 998149, 998150, 998151, 998152, 998153, 998154, 998155, 998156, 998157, 998158, 998159, 998160, 998161, 998162, 998163, 998164, 998165, 998166, 998167, 998168, 998169, 998170, 998171, 998172, 998173, 998174, 998175, 998176, 998177, 998178, 998179, 998180, 998181, 998182, 998183, 998184, 998185, 998186, 998187, 998188, 998189, 998190, 998191, 998192, 998193, 998194, 998195, 998196, 998197, 998198, 998199, 998200, 998201, 998202, 998203, 998204, 998205, 998206, 998207, 998208, 998209, 998210, 998211, 998212, 998213, 998214, 998215, 998216, 998217, 998218, 998219, 998220, 998221, 998222, 998223, 998224, 998225, 998226, 998227, 998228, 998229, 998230, 998231, 998232, 998233, 998234, 998235, 998236, 998237, 998238, 998239, 998240, 998241, 998242, 998243, 998244, 998245, 998246, 998247, 998248, 998249, 998250, 998251, 998252, 998253, 998254, 998255, 998256, 998257, 998258, 998259, 998260, 998261, 998262, 998263, 998264, 998265, 998266, 998267, 998268, 998269, 998270, 998271, 998272, 998273, 998274, 998275, 998276, 998277, 998278, 998279, 998280, 998281, 998282, 998283, 998284, 998285, 998286, 998287, 998288, 998289, 998290, 998291, 998292, 998293, 998294, 998295, 998296, 998297, 998298, 998299, 998300, 998301, 998302, 998303, 998304, 998305, 998306, 998307, 998308, 998309, 998310, 998311, 998312, 998313, 998314, 998315, 998316, 998317, 998318, 998319, 998320, 998321, 998322, 998323, 998324, 998325, 998326, 998327, 998328, 998329, 998330, 998331, 998332, 998333, 998334, 998335, 998336, 998337, 998338, 998339, 998340, 998341, 998342, 998343, 998344, 998345, 998346, 998347, 998348, 998349, 998350, 998351, 998352, 998353, 998354, 998355, 998356, 998357, 998358, 998359, 998360, 998361, 998362, 998363, 998364, 998365, 998366, 998367, 998368, 998369, 998370, 998371, 998372, 998373, 998374, 998375, 998376, 998377, 998378, 998379, 998380, 998381, 998382, 998383, 998384, 998385, 998386, 998387, 998388, 998389, 998390, 998391, 998392, 998393, 998394, 998395, 998396, 998397, 998398, 998399, 998400, 998401, 998402, 998403, 998404, 998405, 998406, 998407, 998408, 998409, 998410, 998411, 998412, 998413, 998414, 998415, 998416, 998417, 998418, 998419, 998420, 998421, 998422, 998423, 998424, 998425, 998426, 998427, 998428, 998429, 998430, 998431, 998432, 998433, 998434, 998435, 998436, 998437, 998438, 998439, 998440, 998441, 998442, 998443, 998444, 998445, 998446, 998447, 998448, 998449, 998450, 998451, 998452, 998453, 998454, 998455, 998456, 998457, 998458, 998459, 998460, 998461, 998462, 998463, 998464, 998465, 998466, 998467, 998468, 998469, 998470, 998471, 998472, 998473, 998474, 998475, 998476, 998477, 998478, 998479, 998480, 998481, 998482, 998483, 998484, 998485, 998486, 998487, 998488, 998489, 998490, 998491, 998492, 998493, 998494, 998495, 998496, 998497, 998498, 998499, 998500, 998501, 998502, 998503, 998504, 998505, 998506, 998507, 998508, 998509, 998510, 998511, 998512, 998513, 998514, 998515, 998516, 998517, 998518, 998519, 998520, 998521, 998522, 998523, 998524, 998525, 998526, 998527, 998528, 998529, 998530, 998531, 998532, 998533, 998534, 998535, 998536, 998537, 998538, 998539, 998540, 998541, 998542, 998543, 998544, 998545, 998546, 998547, 998548, 998549, 998550, 998551, 998552, 998553, 998554, 998555, 998556, 998557, 998558, 998559, 998560, 998561, 998562, 998563, 998564, 998565, 998566, 998567, 998568, 998569, 998570, 998571, 998572, 998573, 998574, 998575, 998576, 998577, 998578, 998579, 998580, 998581, 998582, 998583, 998584, 998585, 998586, 998587, 998588, 998589, 998590, 998591, 998592, 998593, 998594, 998595, 998596, 998597, 998598, 998599, 998600, 998601, 998602, 998603, 998604, 998605, 998606, 998607, 998608, 998609, 998610, 998611, 998612, 998613, 998614, 998615, 998616, 998617, 998618, 998619, 998620, 998621, 998622, 998623, 998624, 998625, 998626, 998627, 998628, 998629, 998630, 998631, 998632, 998633, 998634, 998635, 998636, 998637, 998638, 998639, 998640, 998641, 998642, 998643, 998644, 998645, 998646, 998647, 998648, 998649, 998650, 998651, 998652, 998653, 998654, 998655, 998656, 998657, 998658, 998659, 998660, 998661, 998662, 998663, 998664, 998665, 998666, 998667, 998668, 998669, 998670, 998671, 998672, 998673, 998674, 998675, 998676, 998677, 998678, 998679, 998680, 998681, 998682, 998683, 998684, 998685, 998686, 998687, 998688, 998689, 998690, 998691, 998692, 998693, 998694, 998695, 998696, 998697, 998698, 998699, 998700, 998701, 998702, 998703, 998704, 998705, 998706, 998707, 998708, 998709, 998710, 998711, 998712, 998713, 998714, 998715, 998716, 998717, 998718, 998719, 998720, 998721, 998722, 998723, 998724, 998725, 998726, 998727, 998728, 998729, 998730, 998731, 998732, 998733, 998734, 998735, 998736, 998737, 998738, 998739, 998740, 998741, 998742, 998743, 998744, 998745, 998746, 998747, 998748, 998749, 998750, 998751, 998752, 998753, 998754, 998755, 998756, 998757, 998758, 998759, 998760, 998761, 998762, 998763, 998764, 998765, 998766, 998767, 998768, 998769, 998770, 998771, 998772, 998773, 998774, 998775, 998776, 998777, 998778, 998779, 998780, 998781, 998782, 998783, 998784, 998785, 998786, 998787, 998788, 998789, 998790, 998791, 998792, 998793, 998794, 998795, 998796, 998797, 998798, 998799, 998800, 998801, 998802, 998803, 998804, 998805, 998806, 998807, 998808, 998809, 998810, 998811, 998812, 998813, 998814, 998815, 998816, 998817, 998818, 998819, 998820, 998821, 998822, 998823, 998824, 998825, 998826, 998827, 998828, 998829, 998830, 998831, 998832, 998833, 998834, 998835, 998836, 998837, 998838, 998839, 998840, 998841, 998842, 998843, 998844, 998845, 998846, 998847, 998848, 998849, 998850, 998851, 998852, 998853, 998854, 998855, 998856, 998857, 998858, 998859, 998860, 998861, 998862, 998863, 998864, 998865, 998866, 998867, 998868, 998869, 998870, 998871, 998872, 998873, 998874, 998875, 998876, 998877, 998878, 998879, 998880, 998881, 998882, 998883, 998884, 998885, 998886, 998887, 998888, 998889, 998890, 998891, 998892, 998893, 998894, 998895, 998896, 998897, 998898, 998899, 998900, 998901, 998902, 998903, 998904, 998905, 998906, 998907, 998908, 998909, 998910, 998911, 998912, 998913, 998914, 998915, 998916, 998917, 998918, 998919, 998920, 998921, 998922, 998923, 998924, 998925, 998926, 998927, 998928, 998929, 998930, 998931, 998932, 998933, 998934, 998935, 998936, 998937, 998938, 998939, 998940, 998941, 998942, 998943, 998944, 998945, 998946, 998947, 998948, 998949, 998950, 998951, 998952, 998953, 998954, 998955, 998956, 998957, 998958, 998959, 998960, 998961, 998962, 998963, 998964, 998965, 998966, 998967, 998968, 998969, 998970, 998971, 998972, 998973, 998974, 998975, 998976, 998977, 998978, 998979, 998980, 998981, 998982, 998983, 998984, 998985, 998986, 998987, 998988, 998989, 998990, 998991, 998992, 998993, 998994, 998995, 998996, 998997, 998998, 998999, 999000, 999001, 999002, 999003, 999004, 999005, 999006, 999007, 999008, 999009, 999010, 999011, 999012, 999013, 999014, 999015, 999016, 999017, 999018, 999019, 999020, 999021, 999022, 999023, 999024, 999025, 999026, 999027, 999028, 999029, 999030, 999031, 999032, 999033, 999034, 999035, 999036, 999037, 999038, 999039, 999040, 999041, 999042, 999043, 999044, 999045, 999046, 999047, 999048, 999049, 999050, 999051, 999052, 999053, 999054, 999055, 999056, 999057, 999058, 999059, 999060, 999061, 999062, 999063, 999064, 999065, 999066, 999067, 999068, 999069, 999070, 999071, 999072, 999073, 999074, 999075, 999076, 999077, 999078, 999079, 999080, 999081, 999082, 999083, 999084, 999085, 999086, 999087, 999088, 999089, 999090, 999091, 999092, 999093, 999094, 999095, 999096, 999097, 999098, 999099, 999100, 999101, 999102, 999103, 999104, 999105, 999106, 999107, 999108, 999109, 999110, 999111, 999112, 999113, 999114, 999115, 999116, 999117, 999118, 999119, 999120, 999121, 999122, 999123, 999124, 999125, 999126, 999127, 999128, 999129, 999130, 999131, 999132, 999133, 999134, 999135, 999136, 999137, 999138, 999139, 999140, 999141, 999142, 999143, 999144, 999145, 999146, 999147, 999148, 999149, 999150, 999151, 999152, 999153, 999154, 999155, 999156, 999157, 999158, 999159, 999160, 999161, 999162, 999163, 999164, 999165, 999166, 999167, 999168, 999169, 999170, 999171, 999172, 999173, 999174, 999175, 999176, 999177, 999178, 999179, 999180, 999181, 999182, 999183, 999184, 999185, 999186, 999187, 999188, 999189, 999190, 999191, 999192, 999193, 999194, 999195, 999196, 999197, 999198, 999199, 999200, 999201, 999202, 999203, 999204, 999205, 999206, 999207, 999208, 999209, 999210, 999211, 999212, 999213, 999214, 999215, 999216, 999217, 999218, 999219, 999220, 999221, 999222, 999223, 999224, 999225, 999226, 999227, 999228, 999229, 999230, 999231, 999232, 999233, 999234, 999235, 999236, 999237, 999238, 999239, 999240, 999241, 999242, 999243, 999244, 999245, 999246, 999247, 999248, 999249, 999250, 999251, 999252, 999253, 999254, 999255, 999256, 999257, 999258, 999259, 999260, 999261, 999262, 999263, 999264, 999265, 999266, 999267, 999268, 999269, 999270, 999271, 999272, 999273, 999274, 999275, 999276, 999277, 999278, 999279, 999280, 999281, 999282, 999283, 999284, 999285, 999286, 999287, 999288, 999289, 999290, 999291, 999292, 999293, 999294, 999295, 999296, 999297, 999298, 999299, 999300, 999301, 999302, 999303, 999304, 999305, 999306, 999307, 999308, 999309, 999310, 999311, 999312, 999313, 999314, 999315, 999316, 999317, 999318, 999319, 999320, 999321, 999322, 999323, 999324, 999325, 999326, 999327, 999328, 999329, 999330, 999331, 999332, 999333, 999334, 999335, 999336, 999337, 999338, 999339, 999340, 999341, 999342, 999343, 999344, 999345, 999346, 999347, 999348, 999349, 999350, 999351, 999352, 999353, 999354, 999355, 999356, 999357, 999358, 999359, 999360, 999361, 999362, 999363, 999364, 999365, 999366, 999367, 999368, 999369, 999370, 999371, 999372, 999373, 999374, 999375, 999376, 999377, 999378, 999379, 999380, 999381, 999382, 999383, 999384, 999385, 999386, 999387, 999388, 999389, 999390, 999391, 999392, 999393, 999394, 999395, 999396, 999397, 999398, 999399, 999400, 999401, 999402, 999403, 999404, 999405, 999406, 999407, 999408, 999409, 999410, 999411, 999412, 999413, 999414, 999415, 999416, 999417, 999418, 999419, 999420, 999421, 999422, 999423, 999424, 999425, 999426, 999427, 999428, 999429, 999430, 999431, 999432, 999433, 999434, 999435, 999436, 999437, 999438, 999439, 999440, 999441, 999442, 999443, 999444, 999445, 999446, 999447, 999448, 999449, 999450, 999451, 999452, 999453, 999454, 999455, 999456, 999457, 999458, 999459, 999460, 999461, 999462, 999463, 999464, 999465, 999466, 999467, 999468, 999469, 999470, 999471, 999472, 999473, 999474, 999475, 999476, 999477, 999478, 999479, 999480, 999481, 999482, 999483, 999484, 999485, 999486, 999487, 999488, 999489, 999490, 999491, 999492, 999493, 999494, 999495, 999496, 999497, 999498, 999499, 999500, 999501, 999502, 999503, 999504, 999505, 999506, 999507, 999508, 999509, 999510, 999511, 999512, 999513, 999514, 999515, 999516, 999517, 999518, 999519, 999520, 999521, 999522, 999523, 999524, 999525, 999526, 999527, 999528, 999529, 999530, 999531, 999532, 999533, 999534, 999535, 999536, 999537, 999538, 999539, 999540, 999541, 999542, 999543, 999544, 999545, 999546, 999547, 999548, 999549, 999550, 999551, 999552, 999553, 999554, 999555, 999556, 999557, 999558, 999559, 999560, 999561, 999562, 999563, 999564, 999565, 999566, 999567, 999568, 999569, 999570, 999571, 999572, 999573, 999574, 999575, 999576, 999577, 999578, 999579, 999580, 999581, 999582, 999583, 999584, 999585, 999586, 999587, 999588, 999589, 999590, 999591, 999592, 999593, 999594, 999595, 999596, 999597, 999598, 999599, 999600, 999601, 999602, 999603, 999604, 999605, 999606, 999607, 999608, 999609, 999610, 999611, 999612, 999613, 999614, 999615, 999616, 999617, 999618, 999619, 999620, 999621, 999622, 999623, 999624, 999625, 999626, 999627, 999628, 999629, 999630, 999631, 999632, 999633, 999634, 999635, 999636, 999637, 999638, 999639, 999640, 999641, 999642, 999643, 999644, 999645, 999646, 999647, 999648, 999649, 999650, 999651, 999652, 999653, 999654, 999655, 999656, 999657, 999658, 999659, 999660, 999661, 999662, 999663, 999664, 999665, 999666, 999667, 999668, 999669, 999670, 999671, 999672, 999673, 999674, 999675, 999676, 999677, 999678, 999679, 999680, 999681, 999682, 999683, 999684, 999685, 999686, 999687, 999688, 999689, 999690, 999691, 999692, 999693, 999694, 999695, 999696, 999697, 999698, 999699, 999700, 999701, 999702, 999703, 999704, 999705, 999706, 999707, 999708, 999709, 999710, 999711, 999712, 999713, 999714, 999715, 999716, 999717, 999718, 999719, 999720, 999721, 999722, 999723, 999724, 999725, 999726, 999727, 999728, 999729, 999730, 999731, 999732, 999733, 999734, 999735, 999736, 999737, 999738, 999739, 999740, 999741, 999742, 999743, 999744, 999745, 999746, 999747, 999748, 999749, 999750, 999751, 999752, 999753, 999754, 999755, 999756, 999757, 999758, 999759, 999760, 999761, 999762, 999763, 999764, 999765, 999766, 999767, 999768, 999769, 999770, 999771, 999772, 999773, 999774, 999775, 999776, 999777, 999778, 999779, 999780, 999781, 999782, 999783, 999784, 999785, 999786, 999787, 999788, 999789, 999790, 999791, 999792, 999793, 999794, 999795, 999796, 999797, 999798, 999799, 999800, 999801, 999802, 999803, 999804, 999805, 999806, 999807, 999808, 999809, 999810, 999811, 999812, 999813, 999814, 999815, 999816, 999817, 999818, 999819, 999820, 999821, 999822, 999823, 999824, 999825, 999826, 999827, 999828, 999829, 999830, 999831, 999832, 999833, 999834, 999835, 999836, 999837, 999838, 999839, 999840, 999841, 999842, 999843, 999844, 999845, 999846, 999847, 999848, 999849, 999850, 999851, 999852, 999853, 999854, 999855, 999856, 999857, 999858, 999859, 999860, 999861, 999862, 999863, 999864, 999865, 999866, 999867, 999868, 999869, 999870, 999871, 999872, 999873, 999874, 999875, 999876, 999877, 999878, 999879, 999880, 999881, 999882, 999883, 999884, 999885, 999886, 999887, 999888, 999889, 999890, 999891, 999892, 999893, 999894, 999895, 999896, 999897, 999898, 999899, 999900, 999901, 999902, 999903, 999904, 999905, 999906, 999907, 999908, 999909, 999910, 999911, 999912, 999913, 999914, 999915, 999916, 999917, 999918, 999919, 999920, 999921, 999922, 999923, 999924, 999925, 999926, 999927, 999928, 999929, 999930, 999931, 999932, 999933, 999934, 999935, 999936, 999937, 999938, 999939, 999940, 999941, 999942, 999943, 999944, 999945, 999946, 999947, 999948, 999949, 999950, 999951, 999952, 999953, 999954, 999955, 999956, 999957, 999958, 999959, 999960, 999961, 999962, 999963, 999964, 999965, 999966, 999967, 999968, 999969, 999970, 999971, 999972, 999973, 999974, 999975, 999976, 999977, 999978, 999979, 999980, 999981, 999982, 999983, 999984, 999985, 999986, 999987, 999988, 999989, 999990, 999991, 999992, 999993, 999994, 999995, 999996, 999997, 999998, 999999, 1000000]
numbers = list(range(1, 1000001))
for number in numbers:
    print(number)3
731034
731035
731036
731037
731038
731039
731040
731041
731042
731043
731044
731045
731046
731047
731048
731049
731050
731051
731052
731053
731054
731055
731056
731057
731058
731059
731060
731061
731062
731063
731064
731065
731066
731067
731068
731069
731070
731071
731072
731073
731074
731075
731076
731077
731078
731079
731080
731081
731082
731083
731084
731085
731086
731087
731088
731089
731090
731091
731092
731093
731094
731095
731096
731097
731098
731099
731100
731101
731102
731103
731104
731105
731106
731107
731108
731109
731110
731111
731112
731113
731114
731115
731116
731117
731118
731119
731120
731121
731122
731123
731124
731125
731126
731127
731128
731129
731130
731131
731132
731133
731134
731135
731136
731137
731138
731139
731140
731141
731142
731143
731144
731145
731146
731147
731148
731149
731150
731151
731152
731153
731154
731155
731156
731157
731158
731159
731160
731161
731162
731163
731164
731165
731166
731167
731168
731169
731170
731171
731172
731173
731174
731175
731176
731177
731178
731179
731180
731181
731182
731183
731184
731185
731186
731187
731188
731189
731190
731191
731192
731193
731194
731195
731196
731197
731198
731199
731200
731201
731202
731203
731204
731205
731206
731207
731208
731209
731210
731211
731212
731213
731214
731215
731216
731217
731218
731219
731220
731221
731222
731223
731224
731225
731226
731227
731228
731229
731230
731231
731232
731233
731234
731235
731236
731237
731238
731239
731240
731241
731242
731243
731244
731245
731246
731247
731248
731249
731250
731251
731252
731253
731254
731255
731256
731257
731258
731259
731260
731261
731262
731263
731264
731265
731266
731267
731268
731269
731270
731271
731272
731273
731274
731275
731276
731277
731278
731279
731280
731281
731282
731283
731284
731285
731286
731287
731288
731289
731290
731291
731292
731293
731294
731295
731296
731297
731298
731299
731300
731301
731302
731303
731304
731305
731306
731307
731308
731309
731310
731311
731312
731313
731314
731315
731316
731317
731318
731319
731320
731321
731322
731323
731324
731325
731326
731327
731328
731329
731330
731331
731332
731333
731334
731335
731336
731337
731338
731339
731340
731341
731342
731343
731344
731345
731346
731347
731348
731349
731350
731351
731352
731353
731354
731355
731356
731357
731358
731359
731360
731361
731362
731363
731364
731365
731366
731367
731368
731369
731370
731371
731372
731373
731374
731375
731376
731377
731378
731379
731380
731381
731382
731383
731384
731385
731386
731387
731388
731389
731390
731391
731392
731393
731394
731395
731396
731397
731398
731399
731400
731401
731402
731403
731404
731405
731406
731407
731408
731409
731410
731411
731412
731413
731414
731415
731416
731417
731418
731419
731420
731421
731422
731423
731424
731425
731426
731427
731428
731429
731430
731431
731432
731433
731434
731435
731436
731437
731438
731439
731440
731441
731442
731443
731444
731445
731446
731447
731448
731449
731450
731451
731452
731453
731454
731455
731456
731457
731458
731459
731460
731461
731462
731463
731464
731465
731466
731467
731468
731469
731470
731471
731472
731473
731474
731475
731476
731477
731478
731479
731480
731481
731482
731483
731484
731485
731486
731487
731488
731489
731490
731491
731492
731493
731494
731495
731496
731497
731498
731499
731500
731501
731502
731503
731504
731505
731506
731507
731508
731509
731510
731511
731512
731513
731514
731515
731516
731517
731518
731519
731520
731521
731522
731523
731524
731525
731526
731527
731528
731529
731530
731531
731532
731533
731534
731535
731536
731537
731538
731539
731540
731541
731542
731543
731544
731545
731546
731547
731548
731549
731550
731551
731552
731553
731554
731555
731556
731557
731558
731559
731560
731561
731562
731563
731564
731565
731566
731567
731568
731569
731570
731571
731572
731573
731574
731575
731576
731577
731578
731579
731580
731581
731582
731583
731584
731585
731586
731587
731588
731589
731590
731591
731592
731593
731594
731595
731596
731597
731598
731599
731600
731601
731602
731603
731604
731605
731606
731607
731608
731609
731610
731611
731612
731613
731614
731615
731616
731617
731618
731619
731620
731621
731622
731623
731624
731625
731626
731627
731628
731629
731630
731631
731632
731633
731634
731635
731636
731637
731638
731639
731640
731641
731642
731643
731644
731645
731646
731647
731648
731649
731650
731651
731652
731653
731654
731655
731656
731657
731658
731659
731660
731661
731662
731663
731664
731665
731666
731667
731668
731669
731670
731671
731672
731673
731674
731675
731676
731677
731678
731679
731680
731681
731682
731683
731684
731685
731686
731687
731688
731689
731690
731691
731692
731693
731694
731695
731696
731697
731698
731699
731700
731701
731702
731703
731704
731705
731706
731707
731708
731709
731710
731711
731712
731713
731714
731715
731716
731717
731718
731719
731720
731721
731722
731723
731724
731725
731726
731727
731728
731729
731730
731731
731732
731733
731734
731735
731736
731737
731738
731739
731740
731741
731742
731743
731744
731745
731746
731747
731748
731749
731750
731751
731752
731753
731754
731755
731756
731757
731758
731759
731760
731761
731762
731763
731764
731765
731766
731767
731768
731769
731770
731771
731772
731773
731774
731775
731776
731777
731778
731779
731780
731781
731782
731783
731784
731785
731786
731787
731788
731789
731790
731791
731792
731793
731794
731795
731796
731797
731798
731799
731800
731801
731802
731803
731804
731805
731806
731807
731808
731809
731810
731811
731812
731813
731814
731815
731816
731817
731818
731819
731820
731821
731822
731823
731824
731825
731826
731827
731828
731829
731830
731831
731832
731833
731834
731835
731836
731837
731838
731839
731840
731841
731842
731843
731844
731845
731846
731847
731848
731849
731850
731851
731852
731853
731854
731855
731856
731857
731858
731859
731860
731861
731862
731863
731864
731865
731866
731867
731868
731869
731870
731871
731872
731873
731874
731875
731876
731877
731878
731879
731880
731881
731882
731883
731884
731885
731886
731887
731888
731889
731890
731891
731892
731893
731894
731895
731896
731897
731898
731899
731900
731901
731902
731903
731904
731905
731906
731907
731908
731909
731910
731911
731912
731913
731914
731915
731916
731917
731918
731919
731920
731921
731922
731923
731924
731925
731926
731927
731928
731929
731930
731931
731932
731933
731934
731935
731936
731937
731938
731939
731940
731941
731942
731943
731944
731945
731946
731947
731948
731949
731950
731951
731952
731953
731954
731955
731956
731957
731958
731959
731960
731961
731962
731963
731964
731965
731966
731967
731968
731969
731970
731971
731972
731973
731974
731975
731976
731977
731978
731979
731980
731981
731982
731983
731984
731985
731986
731987
731988
731989
731990
731991
731992
731993
731994
731995
731996
731997
731998
731999
732000
732001
732002
732003
732004
732005
732006
732007
732008
732009
732010
732011
732012
732013
732014
732015
732016
732017
732018
732019
732020
732021
732022
732023
732024
732025
732026
732027
732028
732029
732030
732031
732032
732033
732034
732035
732036
732037
732038
732039
732040
732041
732042
732043
732044
732045
732046
732047
732048
732049
732050
732051
732052
732053
732054
732055
732056
732057
732058
732059
732060
732061
732062
732063
732064
732065
732066
732067
732068
732069
732070
732071
732072
732073
732074
732075
732076
732077
732078
732079
732080
732081
732082
732083
732084
732085
732086
732087
732088
732089
732090
732091
732092
732093
732094
732095
732096
732097
732098
732099
732100
732101
732102
732103
732104
732105
732106
732107
732108
732109
732110
732111
732112
732113
732114
732115
732116
732117
732118
732119
732120
732121
732122
732123
732124
732125
732126
732127
732128
732129
732130
732131
732132
732133
732134
732135
732136
732137
732138
732139
732140
732141
732142
732143
732144
732145
732146
732147
732148
732149
732150
732151
732152
732153
732154
732155
732156
732157
732158
732159
732160
732161
732162
732163
732164
732165
732166
732167
732168
732169
732170
732171
732172
732173
732174
732175
732176
732177
732178
732179
732180
732181
732182
732183
732184
732185
732186
732187
732188
732189
732190
732191
732192
732193
732194
732195
732196
732197
732198
732199
732200
732201
732202
732203
732204
732205
732206
732207
732208
732209
732210
732211
732212
732213
732214
732215
732216
732217
732218
732219
732220
732221
732222
732223
732224
732225
732226
732227
732228
732229
732230
732231
732232
732233
732234
732235
732236
732237
732238
732239
732240
732241
732242
732243
732244
732245
732246
732247
732248
732249
732250
732251
732252
732253
732254
732255
732256
732257
732258
732259
732260
732261
732262
732263
732264
732265
732266
732267
732268
732269
732270
732271
732272
732273
732274
732275
732276
732277
732278
732279
732280
732281
732282
732283
732284
732285
732286
732287
732288
732289
732290
732291
732292
732293
732294
732295
732296
732297
732298
732299
732300
732301
732302
732303
732304
732305
732306
732307
732308
732309
732310
732311
732312
732313
732314
732315
732316
732317
732318
732319
732320
732321
732322
732323
732324
732325
732326
732327
732328
732329
732330
732331
732332
732333
732334
732335
732336
732337
732338
732339
732340
732341
732342
732343
732344
732345
732346
732347
732348
732349
732350
732351
732352
732353
732354
732355
732356
732357
732358
732359
732360
732361
732362
732363
732364
732365
732366
732367
732368
732369
732370
732371
732372
732373
732374
732375
732376
732377
732378
732379
732380
732381
732382
732383
732384
732385
732386
732387
732388
732389
732390
732391
732392
732393
732394
732395
732396
732397
732398
732399
732400
732401
732402
732403
732404
732405
732406
732407
732408
732409
732410
732411
732412
732413
732414
732415
732416
732417
732418
732419
732420
732421
732422
732423
732424
732425
732426
732427
732428
732429
732430
732431
732432
732433
732434
732435
732436
732437
732438
732439
732440
732441
732442
732443
732444
732445
732446
732447
732448
732449
732450
732451
732452
732453
732454
732455
732456
732457
732458
732459
732460
732461
732462
732463
732464
732465
732466
732467
732468
732469
732470
732471
732472
732473
732474
732475
732476
732477
732478
732479
732480
732481
732482
732483
732484
732485
732486
732487
732488
732489
732490
732491
732492
732493
732494
732495
732496
732497
732498
732499
732500
732501
732502
732503
732504
732505
732506
732507
732508
732509
732510
732511
732512
732513
732514
732515
732516
732517
732518
732519
732520
732521
732522
732523
732524
732525
732526
732527
732528
732529
732530
732531
732532
732533
732534
732535
732536
732537
732538
732539
732540
732541
732542
732543
732544
732545
732546
732547
732548
732549
732550
732551
732552
732553
732554
732555
732556
732557
732558
732559
732560
732561
732562
732563
732564
732565
732566
732567
732568
732569
732570
732571
732572
732573
732574
732575
732576
732577
732578
732579
732580
732581
732582
732583
732584
732585
732586
732587
732588
732589
732590
732591
732592
732593
732594
732595
732596
732597
732598
732599
732600
732601
732602
732603
732604
732605
732606
732607
732608
732609
732610
732611
732612
732613
732614
732615
732616
732617
732618
732619
732620
732621
732622
732623
732624
732625
732626
732627
732628
732629
732630
732631
732632
732633
732634
732635
732636
732637
732638
732639
732640
732641
732642
732643
732644
732645
732646
732647
732648
732649
732650
732651
732652
732653
732654
732655
732656
732657
732658
732659
732660
732661
732662
732663
732664
732665
732666
732667
732668
732669
732670
732671
732672
732673
732674
732675
732676
732677
732678
732679
732680
732681
732682
732683
732684
732685
732686
732687
732688
732689
732690
732691
732692
732693
732694
732695
732696
732697
732698
732699
732700
732701
732702
732703
732704
732705
732706
732707
732708
732709
732710
732711
732712
732713
732714
732715
732716
732717
732718
732719
732720
732721
732722
732723
732724
732725
732726
732727
732728
732729
732730
732731
732732
732733
732734
732735
732736
732737
732738
732739
732740
732741
732742
732743
732744
732745
732746
732747
732748
732749
732750
732751
732752
732753
732754
732755
732756
732757
732758
732759
732760
732761
732762
732763
732764
732765
732766
732767
732768
732769
732770
732771
732772
732773
732774
732775
732776
732777
732778
732779
732780
732781
732782
732783
732784
732785
732786
732787
732788
732789
732790
732791
732792
732793
732794
732795
732796
732797
732798
732799
732800
732801
732802
732803
732804
732805
732806
732807
732808
732809
732810
732811
732812
732813
732814
732815
732816
732817
732818
732819
732820
732821
732822
732823
732824
732825
732826
732827
732828
732829
732830
732831
732832
732833
732834
732835
732836
732837
732838
732839
732840
732841
732842
732843
732844
732845
732846
732847
732848
732849
732850
732851
732852
732853
732854
732855
732856
732857
732858
732859
732860
732861
732862
732863
732864
732865
732866
732867
732868
732869
732870
732871
732872
732873
732874
732875
732876
732877
732878
732879
732880
732881
732882
732883
732884
732885
732886
732887
732888
732889
732890
732891
732892
732893
732894
732895
732896
732897
732898
732899
732900
732901
732902
732903
732904
732905
732906
732907
732908
732909
732910
732911
732912
732913
732914
732915
732916
732917
732918
732919
732920
732921
732922
732923
732924
732925
732926
732927
732928
732929
732930
732931
732932
732933
732934
732935
732936
732937
732938
732939
732940
732941
732942
732943
732944
732945
732946
732947
732948
732949
732950
732951
732952
732953
732954
732955
732956
732957
732958
732959
732960
732961
732962
732963
732964
732965
732966
732967
732968
732969
732970
732971
732972
732973
732974
732975
732976
732977
732978
732979
732980
732981
732982
732983
732984
732985
732986
732987
732988
732989
732990
732991
732992
732993
732994
732995
732996
732997
732998
732999
733000
733001
733002
733003
733004
733005
733006
733007
733008
733009
733010
733011
733012
733013
733014
733015
733016
733017
733018
733019
733020
733021
733022
733023
733024
733025
733026
733027
733028
733029
733030
733031
733032
733033
733034
733035
733036
733037
733038
733039
733040
733041
733042
733043
733044
733045
733046
733047
733048
733049
733050
733051
733052
733053
733054
733055
733056
733057
733058
733059
733060
733061
733062
733063
733064
733065
733066
733067
733068
733069
733070
733071
733072
733073
733074
733075
733076
733077
733078
733079
733080
733081
733082
733083
733084
733085
733086
733087
733088
733089
733090
733091
733092
733093
733094
733095
733096
733097
733098
733099
733100
733101
733102
733103
733104
733105
733106
733107
733108
733109
733110
733111
733112
733113
733114
733115
733116
733117
733118
733119
733120
733121
733122
733123
733124
733125
733126
733127
733128
733129
733130
733131
733132
733133
733134
733135
733136
733137
733138
733139
733140
733141
733142
733143
733144
733145
733146
733147
733148
733149
733150
733151
733152
733153
733154
733155
733156
733157
733158
733159
733160
733161
733162
733163
733164
733165
733166
733167
733168
733169
733170
733171
733172
733173
733174
733175
733176
733177
733178
733179
733180
733181
733182
733183
733184
733185
733186
733187
733188
733189
733190
733191
733192
733193
733194
733195
733196
733197
733198
733199
733200
733201
733202
733203
733204
733205
733206
733207
733208
733209
733210
733211
733212
733213
733214
733215
733216
733217
733218
733219
733220
733221
733222
733223
733224
733225
733226
733227
733228
733229
733230
733231
733232
733233
733234
733235
733236
733237
733238
733239
733240
733241
733242
733243
733244
733245
733246
733247
733248
733249
733250
733251
733252
733253
733254
733255
733256
733257
733258
733259
733260
733261
733262
733263
733264
733265
733266
733267
733268
733269
733270
733271
733272
733273
733274
733275
733276
733277
733278
733279
733280
733281
733282
733283
733284
733285
733286
733287
733288
733289
733290
733291
733292
733293
733294
733295
733296
733297
733298
733299
733300
733301
733302
733303
733304
733305
733306
733307
733308
733309
733310
733311
733312
733313
733314
733315
733316
733317
733318
733319
733320
733321
733322
733323
733324
733325
733326
733327
733328
733329
733330
733331
733332
733333
733334
733335
733336
733337
733338
733339
733340
733341
733342
733343
733344
733345
733346
733347
733348
733349
733350
733351
733352
733353
733354
733355
733356
733357
733358
733359
733360
733361
733362
733363
733364
733365
733366
733367
733368
733369
733370
733371
733372
733373
733374
733375
733376
733377
733378
733379
733380
733381
733382
733383
733384
733385
733386
733387
733388
733389
733390
733391
733392
733393
733394
733395
733396
733397
733398
733399
733400
733401
733402
733403
733404
733405
733406
733407
733408
733409
733410
733411
733412
733413
733414
733415
733416
733417
733418
733419
733420
733421
733422
733423
733424
733425
733426
733427
733428
733429
733430
733431
733432
733433
733434
733435
733436
733437
733438
733439
733440
733441
733442
733443
733444
733445
733446
733447
733448
733449
733450
733451
733452
733453
733454
733455
733456
733457
733458
733459
733460
733461
733462
733463
733464
733465
733466
733467
733468
733469
733470
733471
733472
733473
733474
733475
733476
733477
733478
733479
733480
733481
733482
733483
733484
733485
733486
733487
733488
733489
733490
733491
733492
733493
733494
733495
733496
733497
733498
733499
733500
733501
733502
733503
733504
733505
733506
733507
733508
733509
733510
733511
733512
733513
733514
733515
733516
733517
733518
733519
733520
733521
733522
733523
733524
733525
733526
733527
733528
733529
733530
733531
733532
733533
733534
733535
733536
733537
733538
733539
733540
733541
733542
733543
733544
733545
733546
733547
733548
733549
733550
733551
733552
733553
733554
733555
733556
733557
733558
733559
733560
733561
733562
733563
733564
733565
733566
733567
733568
733569
733570
733571
733572
733573
733574
733575
733576
733577
733578
733579
733580
733581
733582
733583
733584
733585
733586
733587
733588
733589
733590
733591
733592
733593
733594
733595
733596
733597
733598
733599
733600
733601
733602
733603
733604
733605
733606
733607
733608
733609
733610
733611
733612
733613
733614
733615
733616
733617
733618
733619
733620
733621
733622
733623
733624
733625
733626
733627
733628
733629
733630
733631
733632
733633
733634
733635
733636
733637
733638
733639
733640
733641
733642
733643
733644
733645
733646
733647
733648
733649
733650
733651
733652
733653
733654
733655
733656
733657
733658
733659
733660
733661
733662
733663
733664
733665
733666
733667
733668
733669
733670
733671
733672
733673
733674
733675
733676
733677
733678
733679
733680
733681
733682
733683
733684
733685
733686
733687
733688
733689
733690
733691
733692
733693
733694
733695
733696
733697
733698
733699
733700
733701
733702
733703
733704
733705
733706
733707
733708
733709
733710
733711
733712
733713
733714
733715
733716
733717
733718
733719
733720
733721
733722
733723
733724
733725
733726
733727
733728
733729
733730
733731
733732
733733
733734
733735
733736
733737
733738
733739
733740
733741
733742
733743
733744
733745
733746
733747
733748
733749
733750
733751
733752
733753
733754
733755
733756
733757
733758
733759
733760
733761
733762
733763
733764
733765
733766
733767
733768
733769
733770
733771
733772
733773
733774
733775
733776
733777
733778
733779
733780
733781
733782
733783
733784
733785
733786
733787
733788
733789
733790
733791
733792
733793
733794
733795
733796
733797
733798
733799
733800
733801
733802
733803
733804
733805
733806
733807
733808
733809
733810
733811
733812
733813
733814
733815
733816
733817
733818
733819
733820
733821
733822
733823
733824
733825
733826
733827
733828
733829
733830
733831
733832
733833
733834
733835
733836
733837
733838
733839
733840
733841
733842
733843
733844
733845
733846
733847
733848
733849
733850
733851
733852
733853
733854
733855
733856
733857
733858
733859
733860
733861
733862
733863
733864
733865
733866
733867
733868
733869
733870
733871
733872
733873
733874
733875
733876
733877
733878
733879
733880
733881
733882
733883
733884
733885
733886
733887
733888
733889
733890min(numbers)_____no_output_____max(numbers)_____no_output_____sum(numbers)_____no_output_____#using for loop to print odd numbers
odd_numbers = list(range(1, 21, 2))
for number in odd_numbers:
    print(number)
    1
3
5
7
9
11
13
15
17
19
#using list comprehension to print odd numbers
odd = [value for value in range(1, 21, 2)]
print(odd)[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]
multiples = list(range(3, 30, 3))
for multiple in multiples:
    print(multiple)3
6
9
12
15
18
21
24
27
multiples_1 = [multiple for multiple in range(3, 30, 3)]
print(multiples)[3, 6, 9, 12, 15, 18, 21, 24, 27]
cubes = list(range(1, 11))
for cube in cubes:
    print(cube**3)
1
8
27
64
125
216
343
512
729
1000
cube_1 = [value**3 for value in(range(1, 11))]
print(cube_1)[1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]

### Working with part of a list_____no_output_____

#when using a slice, you specify the index of the first and last elements
players = ['charles', 'martina', 'michael', 'florence', 'eli']
print(players[0:3])['charles', 'martina', 'michael']
# index 1 to 4 will return 2nd to 4th items
players = ['charles', 'martina', 'michael', 'florence', 'eli']
print(players[1:4])['martina', 'michael', 'florence']
# python begins slicing the list from the 1st item when you omit the 1st index
players = ['charles', 'martina', 'michael', 'florence', 'eli']
print(players[:4])['charles', 'martina', 'michael', 'florence']
# you can slice the 3rd item by using index 2 to the end of the list
players = ['charles', 'martina', 'michael', 'florence', 'eli']
print(players[2:])['michael', 'florence', 'eli']
#use -3 to print the last three items
players = ['charles', 'martina', 'michael', 'florence', 'eli']
print(players[-3:])['michael', 'florence', 'eli']

### Looping through a slice_____no_output_____

players = ['charles', 'martina', 'michael', 'florence', 'eli']
print("Here are my first three players on my team:")
for player in players[:3]:
    print(player.title())
Here are my first three players on my team:
Charles
Martina
Michael

# Copying a list
_____no_output_____

my_foods = ['pizza', 'falafel', 'carrot cake']
friend_foods = my_foods[:]

print(f"My favorite foods are: \n{my_foods}")

print(f"My friend's favorite foods are: \n {friend_foods}")My favorite foods are:
['pizza', 'falafel', 'carrot cake']
My friend's favorite foods are:
 ['pizza', 'falafel', 'carrot cake']
my_foods.append('cannoli')
friend_foods.append('ice cream')

my_foods_____no_output_____friend_foods_____no_output_____#equating my_foods to friend_foods doesn't produce a copy of the list
friend_foods = my_foods
my_foods.append('cannoli')
friend_foods.append('ice cream')

print(f"My favorite foods are: \n{my_foods}")My favorite foods are:
['pizza', 'falafel', 'carrot cake', 'cannoli', 'cannoli', 'cannoli', 'ice cream', 'cannoli', 'ice cream', 'cannoli']
items11 = ['yellow', 'green', 'blue', 'orange']
print(f"The first three items from the list are: \n {items11[:3]}")The first three items from the list are:
 ['yellow', 'green', 'blue']
items11 = ['yellow', 'green', 'blue']
items111 = items11[:]
list_names = ['orange', 'red', 'purple', 'violet', 'pink', 'white', 'black']
for list_name in list_names:
    items111.append(list_name)

print(items111)
len(items111)

#print("Three items from the middle of the list are: {}")['yellow', 'green', 'blue', 'orange', 'red', 'purple', 'violet', 'pink', 'white', 'black']
print(f"Three items from the middle of the list are: \n{items111[5:8]}")Three items from the middle of the list are:
['purple', 'violet', 'pink']
print(f"The last three items in the list are: \n{items111[-3:]}")The last three items in the list are:
['pink', 'white', 'black']
#for items in items111:
messe = items111[-3:]

print(f"The last three items in the list are: {messe}")The last three items in the list are: ['pink', 'white', 'black']
print("The last three letters of the last three items in the list are:")
for items in items111:
    print(items[-3:])

The last three letters of the last three items in the list are:
low
een
lue
nge
red
ple
let
ink
ite
ack
print("The last three items in the list are:")
for items in items111[-3:]:
    print(items)The last three items in the list are:
pink
white
black

### This is wrong execution of code_____no_output_____

for items in items111[-3:]:
    print(f"The last three items in the list are: {items}")The last three items in the list are: pink
The last three items in the list are: white
The last three items in the list are: black

### Tuples are used tocretae a list that cannot change. The difference is for list, square brackets are used but for tuples, parentheses are used_____no_output_____

# items in a tiples are accessed the same way as list
dimensions = (200, 50)
print(dimensions[0])200
print(dimensions[1])50
#see what happens when trying to change an item in a tuple
dimensions[0] = 250_____no_output_____#Tuples are technically defined by presence of a comma
#If you want to define one element in a tuple, always add a comma
my_t = (3,) #it doesn't make sense building a tuple with one item, but this happens when tuples are generated automatically_____no_output_____

### Looping through all values in a tuple_____no_output_____

#This is done the same way as list
dimensions_1 = (200, 30, 40)
for dimension in dimensions_1:
    print(dimension)200
30
40

### Writing over a Tuple_____no_output_____

#Although you can't modify a tuple, you can assign a new variable that represents a tuple
#By redefining the entire tuple
dimensions = (200, 50)
print("Original dimensions:")
for dimension in dimensions:
    print(dimension)

dimensions = (400, 100)
print("\nModified dimensions:")
for dimension in dimensions:
    print(dimension)Original dimensions:
200
50

Modified dimensions:
400
100
foods = ('chicken', 'beef', 'pizza', 'salmon')
print("Original menu is:")
for food in foods:
    print(food.title())

foods = ('chicken', 'beef', 'pilau', 'chapati')
print("\nThe ammended menu is:")
for food in foods:
    print(food.title())Original menu is:
Chicken
Beef
Pizza
Salmon

The ammended menu is:
Chicken
Beef
Pilau
Chapati

### If Statements_____no_output_____

cars = ['audi', 'bmw', 'subaru', 'toyota']
for car in cars:
    if car == 'bmw':
        print(car.upper())
    else:
        print(car.title())
Audi
BMW
Subaru
Toyota
# Conditional Tests
car = 'bmw'
car == 'bmw'
_____no_output_____car = 'audi'
car == 'bmw'_____no_output_____#Testing for case sensitivity
car ='Audi'
car == 'audi'_____no_output_____#if case matters, the above is advantegeous. If it doesn't then convert it to lower case
car = 'Audi'
car.lower() == 'audi'_____no_output_____# Checking for Inequality
#To determine whether two values are not equal, you combine an ! and equal sign
requested_topping = 'mushrooms'
if requested_topping != 'anchovies':
    print("Hold the anchovies!")Hold the anchovies!
#Testing numerical values
age = 18
age == 18_____no_output_____answer = 17
if answer != 42:
    print("That is not the correct answer. Please try again!")That is not the correct answer. Please try again!
age = 19
age < 21_____no_output_____age <= 21_____no_output_____age > 21_____no_output_____age >= 21_____no_output_____

### Checking multiple conditions_____no_output_____

age_0 = 22
age_1 = 18
age_0 >=21 and age_1 >= 21_____no_output_____age_1 = 22
age_0 >=21 and age_1 >=21_____no_output_____#To improve readability, you can use parentheses
(age_0 >=21) and (age_1 >=21)_____no_output_____

#### and is returns to true if both conditions are met if not it returns false but or returns to true or false if either of the conditions are met _____no_output_____

age_0 = 22
age_1 = 18
age_0>= 21 or age_1 >= 21_____no_output_____banned_users = ['andrew', 'carolina', 'david']
user = 'marie'
if user not in banned_users:
    print(f"{user.title()}, you can post a response if you wish.")Marie, you can post a response if you wish.

### Boolean Expressions_____no_output_____

#Boolean expressions are conditional test. It's either true or false
car = 'toyota'
if car == 'toyota':
    print("I predict true.")I predict true.
car = 'subaru'
print(f"{car == 'subaru'}, I predict True.")
#print(car == 'subaru')True, I predict True.
car = 'subaru'
print("Is car == 'subaru'? I predict True.")
print(car == 'subaru')

print("\nIs car == 'audi'? I predict false")
print(car == 'audi')Is car == 'subaru'? I predict True.
True

Is car == 'audi'? I predict false
False
car = 'lexus'
print(f"Is car == 'lexus'? I predict True. {car == 'lexus'} \nIs car == 'subaru'? I predict False. {car== 'subaru'}")Is car == 'lexus'? I predict True. True
Is car == 'subaru'? I predict False. False
car1 = ['audi', 'subaru', 'benz']
len(car1) _____no_output_____car2 = ['toyota', 'v8', 'honda', 'cayenne']
len(car2)_____no_output_____print(f"If len(car1)>4, I predict false. {len(car1)>4}")If len(car1)>4, I predict false. False
print(f"If len(car1) == len(car2), I predict True. {len(car1) == len(car2)}")If len(car1) == len(car2), I predict True. False
print(f"If len(car1) <= len(car2), I predict True. {len(car1) <= len(car2)}")If len(car1) <= len(car2), I predict True. True
print(f"If len(car1) > len(car2), I predict True. {len(car1) > len(car2)}")If len(car1) > len(car2), I predict True. False
print(f"If len(car1) < len(car2) and len(car2) > len(car1), I predict True. {len(car1) < len(car2)} and\n{len(car2) > len(car1)}")If len(car1) < len(car2) and len(car2) > len(car1), I predict True. True and
True
if len(car1) < len(car2):
    print("The length of car 1 is less than the length of car 2.")The length of car 1 is less than the length of car 2.
if len(car1) is not len(car2):
    print("True")  True
if len(car1) is len(car2):
    print("True")
else:
    print("False")False
if len(car1) is len(car2):
    print("Length of car1 is same as length of car2")
elif len(car1) > len(car2): #why didn't it print false yet this is true?
    print("False")
else:
    print(f"The length of car1 is {len(car1)} and the length of car2 is {len(car2)}.")
The length of car1 is 3 and the length of car2 is 4.
lists1 = ['sasa', 'mambo', 'niaje', 'vipi']
for lists in lists1:
    print(lists.title())
#if 'sasa' == lists1:
    #print("True")
Sasa
Mambo
Niaje
Vipi

### Checking if an item is in a list: Method 1_____no_output_____

#Check if an item is in the list
lists1 = ['sasa', 'mambo', 'niaje', 'vipi']
for lists in lists1:
    if lists == 'sasa':
        print("True")True
#Check if an item is in the list
#lists2 = ['sasa', 'mambo', 'niaje', 'vipi']
lists = 'Sasa'
if lists.lower() == 'sasa':
    print("True")True

### Checking if an item is in a list: Method 2_____no_output_____

#Check if an item is in the list
lists2 = ['Sasa', 'mambo', 'niaje', 'vipi']
lists = 'sasa'
for lists in lists2:
    if lists.title() == lists2[0]:
        print("True")True

### Checking if an item is in a list: Method 3_____no_output_____

#Check if an item is in the list
lists3 = ['Sasa', 'mambo', 'niaje', 'vipi']
listsa = 'sasa'
for listsa in lists3:
    if listsa.title() in lists3:
        print("True")True

### Checking if an item is in a list: Method 4_____no_output_____

lists2 = ['sasa', 'mambo', 'niaje', 'vipi']
user1 = 'sasa'
if user1 in lists2:
    print("True")True

### Checking if an item is in a list: Method 5_____no_output_____

lists2 = ['sasa', 'mambo', 'niaje', 'vipi']
#user1 = 'sasa'
if 'sasa' in lists2:
    print("True")True

### Checking if an item is in a list: Method 6_____no_output_____

lists2 = ['sasa', 'mambo', 'niaje', 'vipi']
#user1 = 'sasa'
for item in lists2:
    if 'sasa' in item:
        print("True")

True
lists2 = ['sasa', 'mambo', 'niaje', 'vipi']
#user1 = 'sasa'
for item in lists2:
    if 'sacco' not in item:
        print("True")True
True
True
True
#checking if sacco is not in a list
lists2 = ['sasa', 'mambo', 'niaje', 'vipi']
if 'sacco' != lists2:
    print("True")True
#checking if sacco is not in a list
lists2 = ['sasa', 'mambo', 'niaje', 'vipi']
#user1 = 'sasa'
for item in lists2:
    if 'sacco' != item:
        print("True")True
True
True
True
lists2 = ['sasa', 'mambo', 'niaje', 'vipi']
#user1 = 'sasa'
if 'sacco' not in lists2:
    print("Sacco is not in lists2.")Sacco is not in lists2.
lists2 = ['sasa', 'mambo', 'niaje', 'vipi']
user12 = 'sacco'
if user12 not in lists2: #or use: if user12 != lists2
    print("Sacco is not in lists2.")Sacco is not in lists2.

### If Statements_____no_output_____

agem = 19
if agem >= 18:
    print("You are old enough to vote!")You are old enough to vote!
agem = 16
if agem >= 18:
    print("You are old enough to vote!")
else:
    print("You are not old enough to vote.")You are not old enough to vote.
agems = [16, 20]
for agem in agems:
    print(agem >= 18)
    print(agem)
    False
16
True
20
agems = [16, 20]
for agem in agems:
    if agem >= 18:
        print("You are old enough to vote!")
        print(agem)

#print(agem >= 18)
    #elif agem < 18:
        #print("\nYou are not old enough to vote.")You are old enough to vote!
20
agems = [16, 20]
for agem in agems:
    if agem >= 18:
        print(f"You are old enough to vote! Your age is {agem}")
        You are old enough to vote! Your age is 20
agems = [13, 16, 20, 14]
for agem in agems:
    if agem >= 18:
        print(f"You are old enough to vote! Your age is {agem}.")
    elif agem < 18:
        print(f"\nYou are not old enough to vote. Your age is {agem}.")
    else:
        print("You are under age. Try another time.")

You are not old enough to vote. Your age is 13.

You are not old enough to vote. Your age is 16.
You are old enough to vote! Your age is 20.

You are not old enough to vote. Your age is 14.

• Admission for anyone under age 4 is free.
• Admission for anyone between the ages of 4 and 18 is $25.
• Admission for anyone age 18 or older is $40._____no_output_____

#use if statement to determine a person's admission rate:Option 1
age = 12

if age < 4:
    print("Your admission cost is $0.")
elif age < 18:
    print("Your admission cost is $25.")
else:
    print("Your admission cost is $40.")Your admission cost is $25.
#use if statement to determine a person's admission rate:Option 2
age = 12

if age < 4:
    price = 0
elif age < 18:
    price = 25
else:
    price = 40

print(f"Your admission cost is ${price}.")Your admission cost is $25.

### Using Multiple elif blocks_____no_output_____

# Admission for anyone under age 4 is free. # Admission for anyone between the ages of 4 and 18 is 25.
# Admission for anyone under age of 65 is 40.
# Admission for anyone above 65 is 20
age = 12

if age < 4:
    price = 0
elif age < 18:
    price = 25
elif age < 65:
    price = 40
else:
    price = 20

print(f"Your admission cost is ${price}")Your admission cost is $25

## Omitting the else block in an if-elif chain_____no_output_____

bage1 = 65

if bage1 < 4:
    price = 0
elif bage1 < 18:
    price = 25
elif bage1 <= 65:
    price = 40
elif bage1 > 66:
    price = 20

print(f"Your admission cost is$ {price}")Your admission cost is$ 40
bage1 = 68

if bage1 < 4:
    price = 0
elif bage1 < 18:
    price = 25
elif bage1 < 65: #when age 65 is < without equal signs, the output displayed is for previous condition
    price = 40
elif bage1 > 65:
    price = 20

print(f"Your admission cost is$ {price}")Your admission cost is$ 20

### Testing Multiple Conditions: The if-elif-else chain is powerful, but it's only appropriate to use when you just need one test to pass.

### But to check if multiple conditions pass, use a series of if statement with no elif or else blocks_____no_output_____

# check if two conditions need to pass
requested_toppings = ['mushrooms', 'extra cheese']

if 'mushrooms' in requested_toppings:
    print("Adding mushrooms.")
if 'pepperoni' in requested_toppings:
    print("Adding pepperoni.")
if 'extra cheese' in requested_toppings:
    print("Adding extra cheese.")

print("\nFinished making your pizza!")Adding mushrooms.
Adding extra cheese.

Finished making your pizza!
# This is how the output would look like if the if-elif block was used
requested_toppings = ['mushrooms', 'extra cheese']

if 'mushrooms' in requested_toppings:
    print("Adding mushrooms.")
elif 'pepperoni' in requested_toppings:
    print("Adding pepperoni.")
elif 'extra cheese' in requested_toppings:
    print("Adding extra cheese.")

print("\nFinished making your pizza!")Adding mushrooms.

Finished making your pizza!
alien_color = 'green'
if alien_color == 'green':
    print("You've earned 5 points!")
You've earned 5 points!
alien_color = 'green'
if alien_color == 'yellow':
    print("You've earned 0 points!")
if alien_color == 'green':
    print("You've earned 5 points!")
You've earned 5 points!
alien_color1 = 'yellow'

if alien_color1 != 'yellow':
    print("You've earned 0 points!")
else:
    print("Try again")
Try again
#The if block
alien_color = 'green'

if alien_color == 'green':
    print("You've earned 5 points!")
if alien_color != 'green':
    print("You've earned 10 points!")You've earned 5 points!
#The else block
alien_color = 'green'

if alien_color == 'green':
    print("You've earned 5 points!")
else:
    print("You've earned 10 points!")You've earned 5 points!
#Writing the below code gives no output
alien_color2 = ['yellow', 'green', 'red']

if alien_color2 == 'green':
    print("You've earned 5 points!")
if alien_color2 == 'yellow':
    print("You've earned 10 points!")
if alien_color2 == 'red':
    print("You've earned 15 points!")_____no_output_____#Writing the below code while interchanging the above gives no output either
alien_color2 = ['yellow', 'green', 'red']

if 'green' == alien_color2:
    print("You've earned 5 points!")
if 'yellow' == alien_color2:
    print("You've earned 10 points!")
if 'red' == alien_color2:
    print("You've earned 15 points!")_____no_output_____#Using in instead of == gives output
alien_color2 = ['yellow', 'green', 'red']

if 'green' in alien_color2:
    print("You've earned 5 points!")
if 'yellow' in alien_color2:
    print("You've earned 10 points!")
if 'red' in alien_color2:
    print("You've earned 15 points!")You've earned 5 points!
You've earned 10 points!
You've earned 15 points!
#using if-elif-else block
alien_color2 = ['yellow', 'green', 'red']

if 'green' in alien_color2:
    print("You've earned 5 points!")
elif 'yellow' in alien_color2:
    print("You've earned 10 points!")
elif 'red' in alien_color2:
    print("You've earned 15 points!")
else:
    print("Try again")You've earned 5 points!

### Using if statements with lists_____no_output_____

#Checking for special item
requested_toppings = ['mushrooms', 'green peppers', 'extra cheese']

for requested_topping in requested_toppings:
    print(f"Adding {requested_topping}.")

print("\nFinished making your pizza!")Adding mushrooms.
Adding green peppers.
Adding extra cheese.

Finished making your pizza!
#if green pepper is over, an if statement inside for loop will handle the situation appropriately
requested_toppings = ['mushrooms', 'green peppers', 'extra cheese']

for requested_topping in requested_toppings:
    if requested_topping == 'green peppers':
        print(f"Sorry we are out of {requested_topping} right now.") # instead of wring {requested_topping}, you can write green peppers
    else:
        print(f"Adding {requested_topping}.")

print("\nFinished making your pizza!")Adding mushrooms.
Sorry we are out of green peppers right now.
Adding extra cheese.

Finished making your pizza!
# Checking that a list is not empty
requested_toppings = []

if requested_toppings:
    for requested_topping in requested_toppings:
        print(f"Adding {requested_topping}.")
    print("\nFinished making your pizza!")
else:
    print("Are you sure you want a plain pizza?")
Are you sure you want a plain pizza?

### Using multiple lists_____no_output_____

# Having one list for available toppings and the other for requested toppings
available_toppings = ['mushrooms', 'olives', 'green peppers', 'pepperoni', 'pineapple', 'extra cheese']

requested_toppings1a = ['mushrooms', 'french fries', 'extra cheese']

for requested_topping in requested_toppings1a:
    if requested_topping in available_toppings:
        print(f"Adding {requested_topping}.")
    else:
        print(f"Sorry, we don't have {requested_topping}.")

print("\nFinished making your pizza!")Adding mushrooms.
Sorry, we don't have french fries.
Adding extra cheese.

Finished making your pizza!
user_names = ['admin', 'pink', 'purple', 'orange', 'blue']

for user in user_names:
    print(f"Good evening {user.title()}")Good evening Admin
Good evening Pink
Good evening Purple
Good evening Orange
Good evening Blue
user_names = ['admin', 'pink', 'purple', 'orange', 'blue']

for user in user_names:
    if user == 'admin':
        print(f"Hello {user.title()}, would you like to see a status report?")Hello Admin, would you like to see a status report?
user_names = ['admin', 'pink', 'purple', 'orange', 'blue']

for user in user_names:
    if 'admin' in user: #Use the above code or this method
        print(f"Hello {user.title()}, would you like to see a status report?")Hello Admin, would you like to see a status report?
user_names = ['admin', 'pink', 'purple', 'orange', 'blue']

for user in user_names:
    if 'admin' in user: #Use the above code or this method
        print(f"Hello {user.title()}, would you like to see a status report?")
    else:
        print(f"Hello {user}, thank you for logging in.")Hello Admin, would you like to see a status report?
Hello pink, thank you for logging in.
Hello purple, thank you for logging in.
Hello orange, thank you for logging in.
Hello blue, thank you for logging in.
user_names = ['admin', 'pink', 'purple', 'orange', 'blue']

for user in user_names:
    if 'admin' in user: #Use the above code or this method
        print(f"Hello {user.title()}, would you like to see a status report?")

print(f"\nHello {user.title()}, thank you for logging in.")Hello Admin, would you like to see a status report?

Hello Blue, thank you for logging in.
# Checking if the user_name list is not empty(
user_names = ['admin', 'pink', 'purple', 'orange', 'blue']

for user in user_names:
    if user in user_names:
        print(user.title())Admin
Pink
Purple
Orange
Blue
user_names = ['admin', 'pink', 'purple', 'orange', 'blue']

for user in user_names:
    print(user.title())Admin
Pink
Purple
Orange
Blue
user_names = ['admin', 'pink', 'purple', 'orange', 'blue']

for user in user_names:
    if user in user_names:
        print(user.title())
    if user not in user_names:
        print("We need to find some users!")Admin
Pink
Purple
Orange
Blue
user_names2a = ['admin', 'pink', 'purple', 'orange', 'blue']

print("My original list is:")
for user in user_names2a:
    print(user.title())
My original list is:
Admin
Pink
Purple
Orange
Blue
user_names2a = ['admin', 'pink', 'purple', 'orange', 'blue']

print("My new list is:")
for user in user_names2a:
    if user_names2a.remove(user):
        print(user)
    My new list is:
user_names2ab = ['admin', 'pink', 'purple', 'orange', 'blue']

for user in user_names2ab:
    new_list = user_names2ab.remove(user)

print(new_list)None
user_names2ab = ['admin', 'pink', 'purple', 'orange', 'blue']

for user in user_names2ab:
    new_list = user_names2ab.remove(user)

print(f"My new list is: {new_list}")My new list is: None

### Make two list. One for current users and the other for new users. Use if statement to check if the new username is available or not. Also use case senstivity to check for the names. _____no_output_____

current_users = ['hello', 'bye' 'hi', 'good morning', 'good evening']

new_users = ['BYE', 'Hello', 'yes', 'good morning', 'aloha']

for user in current_users:
    if user == user.title() and user.upper() in new_users:
        print("Enter a new username.")
    elif user != user.title() and user.upper() in new_users:
        print("The username is available!")_____no_output_____current_usersa = ['hello', 'bye' 'hi', 'good morning', 'good evening']

new_usersa = ['BYE', 'Hello', 'yes', 'good morning', 'aloha']
for new in new_usersa:
    current_usersa == new.title()

print("Enter a new user name!")Enter a new user name!
current_usersa = ['hello', 'bye' 'hi', 'good morning', 'good evening']

new_usersa = ['BYE', 'Hello', 'yes', 'good morning', 'aloha']

for new in new_usersa:
    if new in current_usersa:
        print(f"Enter a new user name! {new} has been used.")
    if new.title() in new_usersa:
        print(f"Enter a new user name! {new.title()} has been used.")
    if new.upper() in new_usersa:
        print(f"Enter a new user name! {new.upper()} has been used.")
    elif new not in current_usersa:
        print("The name is available!")Enter a new user name! BYE has been used.
Enter a new user name! Hello has been used.
The name is available!
The name is available!
Enter a new user name! good morning has been used.
The name is available!
current_users = ['hello', 'yes', 'hi', 'good morning', 'good evening']
new_users = ['bye', 'Hello', 'YES', 'good morning', 'aloha']
print(f"\nThe new users list is: {new_users}")

print(f"The original list is: {current_users}")

current_users1 = current_users[:]
print(f"\nThe cloned list is: {current_users1}")

for user in new_users:
    if user.title() in current_users1:
        print("Enter a new username.")
    if user.upper() in current_users1:
        print("Enter a new username.")
    if user in current_users1:
        print("Enter a new username.")
    if user != current_users1:
        print("The username is available!")

The new users list is: ['bye', 'Hello', 'YES', 'good morning', 'aloha']
The original list is: ['hello', 'yes', 'hi', 'good morning', 'good evening']

The cloned list is: ['hello', 'yes', 'hi', 'good morning', 'good evening']
The username is available!
The username is available!
The username is available!
Enter a new username.
The username is available!
The username is available!
#The best way to write the above code is by making a copy of the current users
#Instead of using [:], use [] then add details inside of the square brackets i.e
current_users = ['hello', 'yes', 'hi', 'good morning', 'good evening']
new_users = ['bye', 'Hello', 'YES', 'good morning', 'aloha']

current_users_lower = [user.lower() for user in current_users]

for new_user in new_users:
    if new_user.lower() in current_users: # using current_users_lower still gives the same feedback
        print(f"Sorry, {new_user} that name is taken. Enter a new username!")
    else:
        print(f"Great, {new_user} is still available!")Great, bye is still available!
Sorry, Hello that name is taken. Enter a new username!
Sorry, YES that name is taken. Enter a new username!
Sorry, good morning that name is taken. Enter a new username!
Great, aloha is still available!
items = []
value = list(range(1, 10))
items.append(value)
print(items)[[1, 2, 3, 4, 5, 6, 7, 8, 9]]
items.append(list(range(1,10)))
items_____no_output_____for item in items:
    print(item)[1, 2, 3, 4, 5, 6, 7, 8, 9]
[1, 2, 3, 4, 5, 6, 7, 8, 9]
#CHECK THE OUT WHEN USING APPEND and list in range()
items1 = []
items1.append(list(range(1,10)))
items1_____no_output_____#CHECK THE OUT WHEN USING extend and list in range()
items3 = []
items3.extend(list(range(1,10)))
items3_____no_output_____for item in items1:
    print(item)[1, 2, 3, 4, 5, 6, 7, 8, 9]
item2 = [1, 2, 3, 4, 5, 6, 7, 8, 9]

for item in item2:
    print(item)1
2
3
4
5
6
7
8
9
item5 = []
value = range(1, 10) #This is wrong
item5.append(value)
item5_____no_output_____#The right way to use append when putting values in a list
item4 = []

for value in range(1, 10):
    item4.append(value)

item4_____no_output_____for item in item4:
    print(item)1
2
3
4
5
6
7
8
9
for item in item4:
    if item == 1:
        print('1st')
    elif item == 2:
        print('2nd')
    else:
        print(f"{item}th") # or use str(item) + "th" as shown in the next code below1st
2nd
3th
4th
5th
6th
7th
8th
9th
for item in item4:
    if item == 1:
        print('1st')
    elif item == 2:
        print('2nd')
    else:
        print(str{item} + "th") #only use the curvy brackets while using the f function_____no_output_____for item in item4:
    if item == 1:
        print('1st')
    elif item == 2:
        print('2nd')
    else:
        print(str(item) + "th") #Use the normal brackest not the curvy brackets as above1st
2nd
3th
4th
5th
6th
7th
8th
9th

## Chapter 6: Dictionaries
### Learn to:
#### a. Create a dictionary and store information in it i.e age, location, profession etc
#### b. Store info i.e a list of people names etc

## N/B Use curvy brackets when creating a dictionary_____no_output_____

# Example of a simple dictionary: featuring aliens with different colors

alien_0 = {'color': 'green', 'points': 5}

print(f"{alien_0['color']} \n{alien_0['points']}")green
5
# The above can also be written as
alien_0 = {'color': 'green', 'points': 5}

print(alien_0['color'])
print(alien_0['points'])green
5

### A dictionary in python is a collection of key-value pairs. Each key is connected to a value and you can use a key to access the value associated with the key

### A keys value can be a number, a string, a list or another dictionary

### To acces a value in a dictionary, get the name of the dictionary and its key. Place the key inside the square brackets then use the print()_____no_output_____### you can access either the color or the point value of alien_0. If a player shoots down this alien, you can look up how many points they should earn using the code below:_____no_output_____

new_points = alien_0['points']

print(f"You just earned {new_points} points!")You just earned 5 points!

### Adding new key-value in a dictionary. Use the x and y coordinates by first placing the alien on the left edge of the screen, 25 pixels down from the top. This is because the screen coordinates usually start at the upper-left corner of the screen, we'll place the alien on the left edge of the screen by setting the x-coordinate to 0 and 25 pixels from the top by setting its y-coordinate to positive 25 as shown below_____no_output_____

#Adding new key-value pairs

alien_0['x_position'] = 0
alien_0['y_position'] = 25
print(alien_0){'color': 'green', 'points': 5, 'x_position': 0, 'y_position': 25}
alien_0['age'] = 78
alien_0['height'] = '5"'
print(alien_0){'color': 'green', 'points': 5, 'x_position': 0, 'y_position': 25, 'age': 78, 'height': '5"'}

### Looping through a dictionary to print the key and value_____no_output_____

# Accessing or printing the keys in the alien_0 dictionary using for loop
for item in alien_0:
    print(item)color
points
x_position
y_position
age
height
# Accessing or printing the values in the alien_0 dictionary using for loop
for item in alien_0:
    print(alien_0[item])green
5
0
25
78
5"
# Accessing or printing the keys and values in the alien_0 dictionary using for loop
for item in alien_0:
    print(f"{item} {alien_0[item]}")color green
points 5
x_position 0
y_position 25
age 78
height 5"
# Improving the above code by adding the colon
for item in alien_0:
    print(f"{item}: {alien_0[item]}")color: green
points: 5
x_position: 0
y_position: 25
age: 78
height: 5"

### Starting with an empty dictionary then add keys and values to it_____no_output_____

alien = {}

alien['color', 'points'] = ['yellow', 10] # This is wrong
print(alien){('color', 'points'): ['yellow', 10]}
alien1 = {}

alien1['color'] = 'yellow' and alien1['points'] = 10 #This is wrong
print(alien1)_____no_output_____alien1 = {}

alien1['color'] = 'yellow'
alien1['points'] = 10
alien1['age'] = 79
alien1['height'] = '6ft'
print(alien1){'color': 'yellow', 'points': 10, 'age': 79, 'height': '6ft'}
word_freq = {}

word_freq['marks'] = [10,29,18,20]
word_freq['clean'] = ['average', 'medium'] #note the output with the use of []
print(word_freq){'marks': [10, 29, 18, 20], 'clean': ['average', 'medium']}
word_freq = {}

word_freq['marks'] = [10,29,18,20]
word_freq['clean'] = 'average', 'medium' #note the output without []
print(word_freq){'marks': [10, 29, 18, 20], 'clean': ('average', 'medium')}
print(word_freq[0]) # indexing can't be used while accessing keys nor values in dictionary. YOU HAVE TO SPECIFY THE KEY OR VALUE as shown below_____no_output_____print(word_freq['clean'])('average', 'medium')
for item in word_freq:
    print(f"{item}: {word_freq[item]}")marks: [10, 29, 18, 20]
clean: ('average', 'medium')

### Modifying Values in a Dictionary by associating the new value to the key_____no_output_____

alien_0 = {'color': 'green'}
print(f"The alien is {alien_0['color']}.")

alien_0['color'] = 'yellow'
print(f"\nThe alien is now {alien_0['color']}")The alien is green.

The alien is now yellow

### For a more interesting example, let's track the position of an alien that can move at different speeds. We'll store a value representing the alien's current speed and then use it to determine how far to the right the alien should move_____no_output_____

alien_1 = {'x_position': 0, 'y_position': 25, 'speed': 'medium'}

print(f"Original position: {alien_1['x_position']}")

# Move the alien to the right.
# Determine hor far to move the alien based on its current speed.
if alien_1['speed'] == 'slow':
    x_increment = 1
elif alien_1['speed'] == 'medium':
    x_increment = 2
else:
    # This must be a fast alien.
    x_increment = 3

#The new position is the old position plus the increment.
alien_1['x_position'] =alien_1['x_position'] + x_increment

print(f"New position: {alien_1['x_position']}")Original position: 0
New position: 2
#Turn the speed of the alien from medium to fast
alien_1['speed'] = 'fast'

print(f"Original position: {alien_1['x_position']}")

# Move the alien to the right.
# Determine hor far to move the alien based on its current speed.
if alien_1['speed'] == 'slow':
    x_increment = 1
elif alien_1['speed'] == 'medium':
    x_increment = 2
else:
    # This must be a fast alien.
    x_increment = 3

#The new position is the old position plus the increment.
alien_1['x_position'] =alien_1['x_position'] + x_increment

print(f"New position: {alien_1['x_position']}")
Original position: 2
New position: 5

### Removing Key Value Points. Using delete removes the key and value permanently_____no_output_____

alien_0 = {'color': 'green', 'points': 5}
print(alien_0){'color': 'green', 'points': 5}
del alien_0['points']
print(alien_0){'color': 'green'}

### A dictionary of similar objects. This is effective when storing values of a poll. i.e which is your favourite programming languge_____no_output_____

# Breaking the larger dictionary into several lines
favourite_language = {
    'jen': 'python',
    'sarah': 'c',
    'edward': 'ruby',
    'phil': 'python'
    }

language = favourite_language['sarah'].title()
print(f"Sarah's favourite language is {language}.") # This code is cleaner than the below formatSarah's favourite language is C.
print(f"Sarah's favourite language is {favourite_language['sarah'].title()}.")Sarah's favourite language is C.

### Using get() to access the values_____no_output_____

# Using keys in square brackets to retrieve the value you’re interested in from a dictionary might cause one potential problem: if the key you ask for doesn’t exist, you’ll get an error.

# Try printing value of an alien that doesn't exist
alien_0 = {'color': 'green', 'speed': 'slow'}
print(alien_0['points'])_____no_output_____# The get() method requires a key as a first argument.
# As a second optional argument, you can pass the value to be returned if the key doesn’t exist:
alien_0 = {'color': 'green', 'speed': 'slow'}
point_value = alien_0.get('points', 'No point value assigned.')
print(point_value)

# If there’s a chance the key you’re asking for might not exist, consider using the get() method instead of the square bracket notation.

# If you leave out the second argument in the call to get() and the key doesn’t exist, Python will return the value None. The special value None means “no value exists.” This is not an error: it’s a special value meant to indicate the absence of a value.No point value assigned.
dotty_1 = {'first_name': 'dorothy', 'last_name': 'isiaho', 'age': 30, 'city': 'mombasa'}

print(dotty_1['first_name'].title())
print(dotty_1['last_name'].title())
print(dotty_1['age'])
print(dotty_1['city'].title())Dorothy
Isiaho
30
Mombasa
favorite_number = {
    'jess': 1,
    'lawy': 2,
    'felix': 3,
    'rodah': 4,
    'doty': 5,
    }

print(favorite_number){'jess': 1, 'lawy': 2, 'felix': 3, 'rodah': 4, 'doty': 5}
item_a = favorite_number['jess']
item_b = favorite_number['lawy']
item_c = favorite_number['felix']
item_d = favorite_number['rodah']
item_e = favorite_number['doty']
d = "favorite number is"
print(f"Jess {d} {item_a}. \nLawy {d} {item_b}. \nFelix {d} {item_c}. \nRodah {d} {item_d}. \nDoty {d} {item_e}.   ")Jess favorite number is 1.
Lawy favorite number is 2.
Felix favorite number is 3.
Rodah favorite number is 4.
Doty favorite number is 5.
f = "favorite number is:"

for item in favorite_number:
    print(f"{item.title()} favorite number is: {favorite_number[item]}")
    Jess favorite number is: 1
Lawy favorite number is: 2
Felix favorite number is: 3
Rodah favorite number is: 4
Doty favorite number is: 5
f = "favorite number is:"

for item in favorite_number:
    g = favorite_number[item]
    print(f"\n{item.title()} {f} {g}")
Jess favorite number is: 1

Lawy favorite number is: 2

Felix favorite number is: 3

Rodah favorite number is: 4

Doty favorite number is: 5

### Looping through a dictionary_____no_output_____

# Looping through all key value pairs

user_1 = {
    'first_name': 'dorothy',
    'last_name': 'isiaho',
    'age': 30,
    'city': 'mombasa'
    }

for key, value in user_1.items():
    print(f"\nKey: {key}")
    print(f"Value: {value}")
Key: first_name
Value: dorothy

Key: last_name
Value: isiaho

Key: age
Value: 30

Key: city
Value: mombasa
favourite_language = {
    'jen': 'python',
    'sarah': 'c',
    'edward': 'ruby',
    'phil': 'python'
    }

for name, language in favourite_language.items():
    print(f"{name.title()}'s favorite language is {language.title()}.")Jen's favorite language is Python.
Sarah's favorite language is C.
Edward's favorite language is Ruby.
Phil's favorite language is Python.
# Looping through all the keys in a Dictionary
favourite_language = {
    'jen': 'python',
    'sarah': 'c',
    'edward': 'ruby',
    'phil': 'python',
    }

for name in favourite_language.key():
    print(name.title())_____no_output_____# Looping through all the keys in a Dictionary
favourite_language = {
    'jen': 'python',
    'sarah': 'c',
    'edward': 'ruby',
    'phil': 'python',
    }

for name in favourite_language.keys():
    print(name.title())Jen
Sarah
Edward
Phil
# The above code could actually be written as
for name in favourite_language:
    print(name.title())Jen
Sarah
Edward
Phil
# Loop through the names in the dictionary
# When the name matches, we'll display a message about their favorite language
favourite_language = {
    'jen': 'python',
    'sarah': 'c',
    'edward': 'ruby',
    'phil': 'python',
    }

friends = ['phil', 'sarah']

for name in favourite_language.keys():
    print(name.title())

    if name in friends:
        language = favourite_language[name].title()
        print(f"\n{name.title()}, I see you love {language}!")Jen
Sarah

Sarah, I see you love C!
Edward
Phil

Phil, I see you love Python!
# Use the key() to find out if someone was polled
# Find out if Erin took the poll
favourite_language = {
    'jen': 'python',
    'sarah': 'c',
    'edward': 'ruby',
    'phil': 'python',
    }

if 'erin' not in favourite_language.keys():
    print("Erin, please take our poll!")Erin, please take our poll!
# Looping through a dictionary's keys in a particular order
# Use sorted() to get a copy of the keys in order
for name in sorted(favourite_language.keys()):
    print(f"{name.title()}, thank you for taking the poll.")

Edward, thank you for taking the poll.
Jen, thank you for taking the poll.
Phil, thank you for taking the poll.
Sarah, thank you for taking the poll.
# Use loop to obtain the values of the dictionary using values()
print("The following languages have been mentioned:")
for language in favourite_language.values():
    print(language.title())The following languages have been mentioned:
Python
C
Ruby
Python
# Use the set() to ensure there's no repetition of values
print("The following languages have been mentioned:")
for language in set(favourite_language.values()):
    print(language.title())The following languages have been mentioned:
C
Ruby
Python
### Sets and dictionaries have curvy braces. What differentiate's them is that sets have no keys and values such as
languages = {'python', 'ruby', 'python', 'c'}
languages
_____no_output_____# A dictionary of thre major rivers and their counries
major_rivers = {
    'nile': 'egypt',
    'amazon': 'brazil',
    'mississippi': 'united states',
    }

for river, country in major_rivers.items():
    if river == 'nile':
        print(f"The {river.title()} runs through {country.title()}.")The Nile runs through Egypt.
for river in major_rivers.keys():
    print(river.title())Nile
Amazon
Mississippi
for country in major_rivers.values():
    print(country.title())Egypt
Brazil
United States
favourite_language = {
    'jen': 'python',
    'sarah': 'c',
    'edward': 'ruby',
    'phil': 'python',
    }
poll_list = ['jen', 'erin', 'sarah', 'bill',]

for name in poll_list:
    if name in favourite_language:
        print(f"Thank you {name.title()} for responding. You already took the poll.")
    elif name not in favourite_language:
        print(f"Hello {name.title()}, kindly go ahead and vote.")Thank you Jen for responding. You already took the poll.
Hello Erin, kindly go ahead and vote.
Thank you Sarah for responding. You already took the poll.
Hello Bill, kindly go ahead and vote.

### Nesting is used to store multiple dictionaries in a list, or a list of items as a value in a dictionary.

### You can nest a dictionary inside a dictionary etc_____no_output_____

# A list of Dictionaries
alien_0 = {'color': 'green', 'points': 5}
alien_1 = {'color': 'yellow', 'points': 10}
alien_2 = {'color': 'red', 'points': 15}

aliens = [alien_0, alien_1, alien_2]

for alien in aliens:
    print(alien){'color': 'green', 'points': 5}
{'color': 'yellow', 'points': 10}
{'color': 'red', 'points': 15}
for alien in aliens:
    if alien == alien_0:
        print(alien_0.items())dict_items([('color', 'green'), ('points', 5)])
for alien in aliens:
    if alien == alien_0:
        print(f"The alien_0 color is {alien_0[color]} and it has {alien_0[points]} points.")The alien_0 color is green and it has 5 points.
# using range() to create a fleet of 30 aliens
# Make an empty list for storing aliens

aliens = []

# Make 30 green aliens
for alien_number in range(30):
    new_alien = {'color': 'green', 'points': 5, 'speed': 'slow'}
    aliens.append(new_alien)

# Show the first 5 aliens
for alien in aliens[:5]:
    print(alien)

# Show how many aliens have been created
print(f"Total number of aliens: {len(aliens)}"){'color': 'green', 'points': 5, 'speed': 'slow'}
{'color': 'green', 'points': 5, 'speed': 'slow'}
{'color': 'green', 'points': 5, 'speed': 'slow'}
{'color': 'green', 'points': 5, 'speed': 'slow'}
{'color': 'green', 'points': 5, 'speed': 'slow'}
Total number of aliens: 30
# Change the color, speed and points for the first 3 aliens
for alien in aliens[:3]:
    if alien['color'] == 'green':
        alien['color'] = 'yellow'
        alien['speed'] = 'medium'
        alien['points'] = 10

# Show the fistr five aliens
for alien in aliens[:5]:
    print(alien){'color': 'yellow', 'points': 10, 'speed': 'medium'}
{'color': 'yellow', 'points': 10, 'speed': 'medium'}
{'color': 'yellow', 'points': 10, 'speed': 'medium'}
{'color': 'green', 'points': 5, 'speed': 'slow'}
{'color': 'green', 'points': 5, 'speed': 'slow'}
len(aliens)_____no_output_____for alien in aliens[0:3]:
    if alien['color'] == 'green':
        alien['color'] = 'yellow'
        alien['speed'] = 'medium'
        alien['points'] = 10
    elif alien['color'] == 'yellow':
        alien['color'] = 'red'
        alien['speed'] = 'fast'
        alien['points'] = 15

for alien in aliens[:5]:
    print(alien)
{'color': 'red', 'points': 15, 'speed': 'fast'}
{'color': 'red', 'points': 15, 'speed': 'fast'}
{'color': 'red', 'points': 15, 'speed': 'fast'}
{'color': 'green', 'points': 5, 'speed': 'slow'}
{'color': 'green', 'points': 5, 'speed': 'slow'}

### N/B: All dictionaries in a list should have identical structures i.s users in a website

### You can create a dictionary for each user in the website then store them in a list called users_____no_output_____# A list in a Dictionary_____no_output_____

# A list in a dictionary can be used when storing details of a pizza order

pizza = {
    'crust': 'thick',
    'toppings': ['mushrooms', 'extra cheese'],
    }

# Summarize the order

print(f"You ordered a {pizza['crust']}-crust pizza"
    "with the following toppings:")

for topping in pizza['toppings']:
    print("\t" + topping) # or use print(topping)You ordered a thick-crust pizzawith the following toppings:
	mushrooms
	extra cheese
for topping in pizza['toppings']:
    print("\t" + topping)	mushrooms
	extra cheese

### When you need to break up a long line in a print() call, choose an appropriate point at which to break the line being printed, and end the line with a quotation mark. Indent the next line, add an opening quotation mark, and continue the string. Python will automatically combine all of the strings it finds inside the parentheses as shown above_____no_output_____

# Inside the dictionary's for loop,
# use another for loop to run through the list

favourite_language = {
    'jen': ['python', 'ruby'],
    'sarah': ['c'],
    'edward': ['ruby', 'go'],
    'phil': ['python', 'huskell'],
    }

for name, languages in favourite_language.items():
    print(f"{name.title()}'s favorite languages are:")
    for language in languages:
        print(f"\t{language.title()}")Jen's favorite languages are:
	Python
	Ruby
Sarah's favorite languages are:
	C
Edward's favorite languages are:
	Ruby
	Go
Phil's favorite languages are:
	Python
	Huskell
favourite_language = {
    'jen': ['python', 'ruby'],
    'sarah': ['c'],
    'edward': ['ruby', 'go'],
    'phil': ['python', 'huskell'],
    }

for name, languages in favourite_language.items():
    print(f"{name.title()}'s favorite languages are:")
    for language in languages:
        print(f"\t{language.title()}")_____no_output_____# The above code can be refined further
# By including an if statement at the
# beginning of the dictionary's loop
# By examining the value of len(languages)
# If the person has more than one favorite,
# The output remains the same
# If the person has one favorite language,
# The output changes i.e

favourite_language = {
    'jen': ['python', 'ruby'],
    'sarah': ['c'],
    'edward': ['ruby', 'go'],
    'phil': ['python', 'huskell'],
    }

for name, languages in favourite_language.items():
    if len(languages) > 1:
        print(f"{name.title()}'s favorite languages are:")
    else:
        print(f"{name.title()}'s favorite language is:")
    for language in languages:
        print(f"\t{language.title()}")Jen's favorite languages are:
	Python
	Ruby
Sarah's favorite language is:
	C
Edward's favorite languages are:
	Ruby
	Go
Phil's favorite languages are:
	Python
	Huskell

### A Dictionary in a Dictionary_____no_output_____### For example, if you have several users for a website, each with a unique username, you can use the usernames as the keys in a dictionary.

### You can then store information about each user by using a dictionary as the value associated with their username. In the following listing, we store three pieces of information about each user: their first name, last name, and location.

### We’ll access this information by looping through the usernames and the dictionary of information associated with each username:_____no_output_____

users = {
    'aeinstein': {
        'first': 'albert',
        'last': 'aeinstein',
        'location': 'princeton',
        },

    'mcurie': {
        'first': 'marie',
        'last': 'curie',
        'location': 'paris',
        },
}

for username, user_info in users.items():
    print(f"\nUsername: {username.title()}")
    full_name = f"{user_info['first']} {user_info['last']}"
    location = user_info['location']

    print(f"\tFull name: {full_name.title()}")
    print(f"\tLocation: {location.title()}")
Username: Aeinstein
	Full name: Albert Aeinstein
	Location: Princeton

Username: Mcurie
	Full name: Marie Curie
	Location: Paris
person1 = {'color': 'brown', 'height': 5}
person2 = {'color': 'dark', 'height': 4.5}
person3 = {'color': 'white', 'height': 3.8}

people = [person1, person2, person3]

for person in people:
    print(f" The color of that guest is {person['color']} and the height is {person['height']}.") The color of that guest is brown and the height is 5.
 The color of that guest is dark and the height is 4.5.
 The color of that guest is white and the height is 3.8.

## Chapter 7: User input and While Loops_____no_output_____

# Use while loop to keep programs running
# As long as certain conditions remain true
# Always put a space after the colon or question mark
message = input("Tell me something, and I will repeat it back to you: ")
print(message)When will the world end?
name = input("Please enter your name: ")
print(f"\nHello, {name}!")
Hello, Merab!
# Write a prompt that's longer than one line

prompt = "If you tell us who you are, we can personalize the messages you see."
prompt += "\nWhat is your first name? "

name = input(prompt)
print(f"{prompt} {name}. \n\nHello, {name}!")If you tell us who you are, we can personalize the messages you see.
What is your first name?  Mary.

Hello, Mary!
# Using int() to accept numerical input
# Python interprates everything as a string when using the input()

age = input("How old are you? ")
age

# If you try use print(age), the output is a number
# But when you try to use the output from print(age), you get an error as shown below

_____no_output_____# try use age from print(age)
age = input("How old are you? ")
age >= 18

# The error below is bcoz you can't compare a string to an integer
# Thus, the int() is used to solve the problem_____no_output_____age = input("How old are you? ")
age = int(age)
age >= 18_____no_output_____# using the int() in an actual program
# Consider a program that determines whether
# people are tall enough to ride a roller coaster:_____no_output_____height = input("How tall are you in inches? ")
height = int(height)
print(f"How tall are you in inches? {height}")

if height >= 48:
    print("\nYou are tall enough to ride!")
else:
    print("You'll be able to ride when you are a little older.")How tall are you in inches? 80

You are tall enough to ride!

### The Modulo Operator (%): It divides one number by another and returns the remainder_____no_output_____

4 % 3_____no_output_____5 % 3_____no_output_____6 % 3_____no_output_____7 % 3_____no_output_____# Modulo operator determines if a number is even or odd
# If after division the number is 0, then it's even

number = input("Enter a number and I'll tell you if the number is even or odd: ")
number = int(number)

print(f"Enter a number and I'll tell you if the number is even or odd: {number}")

if number % 2 == 0:
    print(f"\nThe number {number} is even.")
else:
    print(f"\nThe number {number} is odd.")Enter a number and I'll tell you if the number is even or odd: 8

The number 8 is even.
message = input("What kind of a rental car would you like? ")

print(f"What kind of a rental car would you like? {message}."
    f"\n\nLet me see if I can find you a {message}")What kind of a rental car would you like? Subaru.

Let me see if I can find you a Subaru
message = input("How many people are in the dinner group? ")
message = int(message)

print(f"How many people are in the dinner group? {message}.")

if message > 8:
    print("\n\nKindly wait for a table.")
else:
    print("\n\nYour table is ready.")How many people are in the dinner group? 9.

Kindly wait for a table.
prompt = "Give me a number and I'll tell you"
prompt += " if it's a multiple of 10 or not? "

message = input(prompt)
message = int(message)

print(f"{prompt}\n\nThe number is:{message}")

if message % 10 == 0:
    print(f"\n\nNumber {message} is a multiple of 10.")
else:
    print(f"\n\nNumber {message} is not a multiple of 10.")Give me a number and I'll tell you if it's a multiple of 10 or not?

The number is:64

Number 64 is not a multiple of 10.

## Introducing while loops:

### The for loop takes a collection of items and executes a block of code once for each item in the collection. In contrast, the while loop runs as long as, or while, a certain condition is true._____no_output_____

# The while loop in Action
current_number = 1
while current_number <= 5:
    print(current_number)
    current_number += 1

# The += operator is short hand for current_number = current_number + 1
# The loop stops running when current + 1 is <= 51
2
3
4
5
# letting the user choose when to quit
# We’ll define a quit value and then keep the
# program running as long as the user has not entered the quit value:

prompt = "\nTell me something, and I will repeat it back to you:"
prompt += "\nEnter 'quit' to end the program. "
message = ""
while message != 'quit':
    message = input(prompt)
    print(message)

# use if statement to solve the last line (quit)
# if message 1= 'quit':
    #print(message)
Hi mum
What are you doing?
i miss you
I can't wait to see you
I miss you a lot
This world is brutal without you
i love you
Life gets difficult by the day withou you mum
I miss you dearly
quit

## using a flag:
### For a program that should run only as long as many conditions are true, you can define one variable that determines whether or not the entire program is active.
### Our overall while statement needs to check only one condition: whether or not the flag is currently True. Then, all our other tests (to see if an event has occurred that should set the flag to False)

_____no_output_____

# add a flag to the previous program

prompt = "\nTell me something, and I will repeat it back to you:"
prompt += "\nEnter 'quit' to end the program. "

print(f"{prompt}")
active = True
while active:
    message = input(prompt)

    if message == 'quit':
        active = False
    else:
        print(message)
Tell me something, and I will repeat it back to you:
Enter 'quit' to end the program.
Good morning dad
How have you been?
I will cal tomorrow
# Using Break to exit a loop
# A loop that starts with while True u will run forever unless it reaches a break statement.

prompt = "\nPlease enter the name of a city you have visited:"
prompt += "\n(Enter 'quit when you are finished.)"

print(prompt)

while True:
    city = input(prompt)

    if city == 'quit':
        break
    else:
        print(f"I'd love to go to {city.title()}!")

# You could use break to quit a for loop that’s working through a list or a dictionary.
Please enter the name of a city you have visited:
(Enter 'quit when you are finished.)
I'd love to go to New York!
I'd love to go to California!
I'd love to go to Armsterdam!
I'd love to go to Southampton!
I'd love to go to Chicago!

## Using continue in a loop:
### Rather than breaking out of a loop entirely without executing the rest of its code, you can use the continue statement to return to the beginning of theloop based on the result of a conditional test.
### For example, consider a loop that counts from 1 to 10 but prints only the odd numbers in that range:_____no_output_____

current_number = 0
while current_number < 10:
    current_number += 1
    if current_number % 2 == 0:
        continue

    print(current_number)
1
3
5
7
9
# Avoiding infinite loops
x = 1
while x <= 5:
    print(x)
    x += 1 # Ensure this condition is there1
2
3
4
5
# If you omit the line x += 1 as shown below, the while loop will continue to run

x = 1
while x <= 5:
    print(x)1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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