Question: Complete the coding problems below. This assignment primarily focuses on strings, lists, and dictionaries. Make sure to run all code cells so that the output

Complete the coding problems below. This assignment primarily focuses on strings, lists, and dictionaries. Make sure to run all code cells so that the output is displayed. Do NOT insert new cells on this notebook file. Place your code under the commented problem statements. Review python documentation as needed. Submit a PDF version of your completed Jupyter Notebook AND your Jupyter file (.ipynb) to Blackboard. Both files must be uploaded using one Blackboard submission (these are not to be submitted separately using two submissions). Please make sure that the PDF file shows the output of each code cell prior to submitting your files to the system. This assignment is to be completed by yourself.

In [1]:

#Before you begin, run this cell with the code provided below:
import os
os.getcwd()

In [ ]:

"""
1. Use the print function to output your first name and last name as one string value (do not define a variable).
"""
 

In [ ]:

 
"""
2a. Complete the by assigning your first name and last name to the two variables below.
 Then output each variable value using one print function.
"""
fname = 
lname = 
print()

In [ ]:

 
"""
2b. Using the defined variables from 2a and only one print function, display your first name followed by 
a new line that displays your last name. Note: Review the print function documentation (i.e., sep=...). 
"""
 

In [ ]:

 
"""
2c. Display your first name in uppercase using upper() method on fname from problem 2a.
"""
 

In [ ]:

 
"""
3. Using one print function, concatenate (+) fname and lname variables from 2a.
 A space between the first name and last name will be needed.
 Note: Since your first name variable is defined in code cell problem 2a, so you do
 not need to define it again in this code cell (refer to it instead) 
""" 
 

In [ ]:

 
"""
4a. Define a variable named fall_2021 which contains a list of all the courses you are 
taking this semester (e.g., MIS 433, etc.).
Then print the variable.
"""
 

In [ ]:

 
"""
4b. Complete the print statement by using the len() function on the defined variable from 4a.
Remove ??? from the print statement and enter the appropriate code. Then run the cell to output the result.
"""
print("I am taking", ??? , "courses this semester.")

In [ ]:

 
"""
4c. Retrieve the first course from the list variable in 4a. Display the result using a print statement. 
"""
 

In [ ]:

 
"""
5. Use one print function to output: 
 Hello! My name is ____! I'm currently enrolled in ____ courses. 
 Note: Use the fname variable and len() function. 
"""
 

In [ ]:

 
"""
6. Use the append() method on fall_2021 and include "DataCamp" as additional string element.
 Then output the list values using the print function.
"""
 

In [ ]:

 
"""
7. Use the sort() method to order the list in descending order (not ascending order).
 Then output the list using the print function.
"""
 

In [ ]:

 
'''
8. Using negative indexing to slice the last two elements in fall_2021 into a new variable.
 Next use the print function and include the type() function to view the 
 data type of the new variable.
 Then include another print function to display the content of the new variable.
'''
 

In [ ]:

 
"""
9. Create a dictionary variable named current courses_dict that contains one key-value pair. 
 The key should be a string name: "Fall 2021" and its value is the variable containing 
 the list of courses (from problem 6).
 Display the results of your dictionary variable using a print statement.
"""
 

In [ ]:

 
"""
10. Update the dictionary from problem 9 to include an additional key-value pair where 
the key is the string Name, and the value is a list of two variables from problem 2: fname and lname. 
Then display the results of the updated dictionary variable.
"""
 

End of Assignment.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!