WGU C859 Python Foundations Quiz (Best Practice Questions from Actual Past Exam)

https://forms.office.com/Pages/ResponsePage.aspx?id=z5Knz2h3QUOIV4F1TDNEpUTHQoQUJMHLrErGJyHg89uy71MyuHdVWklHQ05aRFMwOVlZ… 1/15
year= 2000
for i in range(2000,2018):
if i % 4 == 0:
year += 4
print (i)
Points: 16/26
1
For years 2000 through 2018, create a list that contains only the leap years for
this time period. Print the completed list. (expected outcome: [2000, 2004, 2008,
2012, 2016]) *
(-/1 Point)
2
Use the following list. Ensure that each name is only listed once and print the
set of unique names. (expected outcome: [‘Cemal’, ‘Dana’, ‘David’, ‘Jerry’]) *
(-/1 Point)

https://forms.office.com/Pages/ResponsePage.aspx?id=z5Knz2h3QUOIV4F1TDNEpUTHQoQUJMHLrErGJyHg89uy71MyuHdVWklHQ05aRFMwOVlZ… 2/15
myNames = [‘Dana’, ‘David’, ‘Cemal’, ‘Jerry’]
if “Letitia” not in myNames:
myNames.append(“Letitia”)
print (myNames)
3
Use the following list. Check to see if Letitia is in the list. If not, add her name
and print the updated list. (expected outcome: [‘Cemal’, ‘Dana’, ‘Jerry’,’Letitia’]) *
(-/1 Point)
4
Use the following dictionary. Print a message for each user in the dictionary that
matches the expected outcome below. (expected outcome for the first
employee (there should be four messages total): Whenever we go out, the
people always shout, John is the Senior VP!) *
(-/1 Point)
myNames = [‘Cemal’, ‘Dana’, ‘David’, ‘Cemal’, ‘Jerry’]
result = set(myNames)
myNames = list(result)
print (myNames)

Leave a Comment

Scroll to Top