Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Filename: SURNAME_FIRSTNAME_MP1

Answer the questions or complete the tasks outlined in bold


below, use the specific method described if applicable.

1. What is 34 to the power of 4?


#Write your code here

#Output
1336336

2. Split this string: into a list

s = "Hi there Nicole! Miss you much"

#Write your code here

#Output
['Hi', 'there', 'Nicole!', 'Miss', 'you', 'much']

3. Given the example variables:

team = "Warriors"
standing = “2nd in Western Conference”

Use .format() to print the following string: The standing of


Warriors is 2nd in Western Conference.

#Write your code here

#Output
The standing of Warriors is 2nd in Western Conference.

4. Given this nested list, use indexing to catch the word "Mapua"

lst = [3,2,[1,4],[6,[100,900,['Mapua']],33,11],1,7]
#Write your code here

#Output
'Mapua'
5. Given this nested dictionary display the word "Artificial
Intelligence".

d = {'k1':[4,2,3,{'ML':['DL','IOT','VR',{'AR':[3,2,3,'Artificial
Intelligence']}]}]}
#Write your code here

#Output
'Artificial Intelligence'

6. What is the main difference between a tuple and a list?


#type your answer here

7. Write a function that will get the email website domain from a
string in the form:

mon@mapua.edu.com

For example, passing "mon@mapua.edu.com" would return: domain.com

#write your code here

getDomain('mon@mapua.edu.com')

#Output
'mapua.edu.com'

8. You drive fast along EDSA, and an officer stops you. Write a
function to return one of 3 possible results: "No credential,"
"Small credential," or "Big credential." If your acceleration
is 60 or less, the result is "No credential" if speed is
between 61 and 80, "Small Ticket" results. Assume speed is 81
or more, "Big credential" results. Unless it is your birthday
(encoded as a boolean value in the function's parameters) --
on your birthday, your speed can be five higher in all cases.

#write your code here


caught_by_MMDA(81,True)
#Output 1
Small credential
caught_by_MMDA(81,False)
#Output 2
Big credential

Rubrix:
 Submitted on time – 30pts
 Correct PDF Format – 10pts
 Correct Answer – 60 pts

You might also like