1. my_var = 3 my_var = “foo” my_var = len Explain this above code is allowed to

1.
my_var = 3
my_var = “foo”
my_var = len
Explain this above code is allowed to not allowed? What is the typy of my_var at the very end?
def double_plus_y(x, y=4):
return 2 * x + y
for value in map(double_plus_y, [1,2,3,4]):
print(value)
Predict the output without running the code.
Use list comphresion the questions from this point on.
In [ ]:
hogwarts_emails = [‘weasley6@hogwarts.edu’,
‘hpotter@gmail.com’,
‘hgranger@gmail.com’,
‘longbott@hogwarts.edu’,
‘dmalfoy@hogwarts.edu’,
‘dthomas@gmail.com’,
‘ppatil@hogwarts.edu’,
‘lunalovegood@quibbler.com’
]
Hogwarts staff want to use the first part of each email as a username. Make a list of these usernames
In [ ]:

Let’s make a dictionary where the keys are the usernames and the values are email addresses
In [ ]:

To read a file, we use the open function. Using with avoids having to remember to close the file. The file path depends on your google drive folder structure. Write python code to find how many countries will be visited.
In [4]:
with open(‘/content/drive/MyDrive/datamining/travel.txt’, ‘r’) as md:
for line in md:
print(line)
This summer I will be travelling.
I will go to…
Italy: Rome
Greece: Athens
England: London, Manchester
France: Paris, Nice, Lyon
Spain: Madrid, Barcelona, Granada
Austria: Vienna
I will probably not even want to come back!
However, I wonder how I will get by with all the different languages.
I only know English!

Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount