Python 3 – Two Python Questions

 

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Hello!

There are TWO Python 3 questions that I need to be completed.

I will attach the PDF with instructions and a ZIP file with the required .py file needed to complete the home.

Thank you!

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

csc242lab1.py
# CSC 242
# Lab 1 template
# Put your name here
# Put your collaborator(s) name(s) here
# You are not allowed to access online resources when completing labs.
# Please log into Zoom and ask your TA if you are unclear on this policy.
# Include doc strings for full credit
# A doc string is a string that appears below the header for a function
# It’s not the same thing as a comment
# Ask if you don’t know what I mean

# You can change the import statement if you wish
from random import *
# Question 1
def cleanData(lst):
pass
# Question 2
def nameGame(lst):
pass

1/7/2021 Lab exercise set 1 — CSC 242-602

facweb.cdm.depaul.edu/asettle/csc242-801/hw/lab1.html 1/3

CSC 242-801: Introduction to Computer Science II

Lab exercise set 1
Due Thursday, January 7th, 10 pm

Logistics

These exercises should be completed during the lab on Thursday, January 7th. The lab template will be available
beginning at 5 pm on D2L, and you should start the lab immediately after finishing the quiz. A grading rubric for lab
sessions is available.

The exercises for this week are a review of material covered in CSC 241. You should find them to be straightforward. If
that’s not the case, please be sure to review your CSC 241 materials as a part of your first week of work for this class. I
have posted recordings reviewing crucial CSC 241 topics in the Course recordings sections on the D2L site.

You are allowed and encouraged to work in groups on lab exercises. If you do work with someone, you must include
the name(s) of your collaborator(s) at the top of the file you submit. For more information about collaboration policies in
this class, see the Academic Integrity Pledge posted to the D2L site.

Begin the lab by downloading the zip file found on the D2L site. It contains a template file csc242lab1.py.

1. Write a function cleanData() that takes a two-dimensional list of numbers (e.g., a list of lists containing float and
int values) representing measurements and modifies the list so that each negative (< 0) number is replaced by a 0. Any zeros or positive values in the list will be unchanged. The function does not return any values but instead modifies the list provided as a parameter. The function is also not allowed to create a new list, since the parameter list must be modified. You should assume that the list given to the function will contain numbers, and your function does not have to behave reasonably on any parameter other than a two-dimensional list of numbers. Note that the list may be empty, in which case it will obviously not be changed by the function. The following shows some sample interactions with the completed function. Note that these examples are just that, and your function must work correctly on any two-dimensional list of numbers:

>>> lst1 = [[1, -2, 3, -4], [5.5, -6.6], [0, -10, 0, 10]]
>>> cleanData(lst1)
>>> lst1
[[1, 0, 3, 0], [5.5, 0], [0, 0, 0, 10]]
>>> lst2 = [[-1], [0], [2], [0], [-3], [0], [4], [0], [5]]
>>> cleanData(lst2)
>>> lst2
[[0], [0], [2], [0], [0], [0], [4], [0], [5]]
>>> lst3 = [[3.3, 4.4, 5.5, 6.6], [0, -1, 0, -2, 0], [3.1415, 7.777]]
>>> cleanData(lst3)
>>> lst3
[[3.3, 4.4, 5.5, 6.6], [0, 0, 0, 0, 0], [3.1415, 7.777]]
>>> lst4 = []
>>> cleanData(lst4)
>>> lst4

http://facweb.cdm.depaul.edu/asettle/csc242-801/info/labs.html

http://d2l.depaul.edu/

1/7/2021 Lab exercise set 1 — CSC 242-602

facweb.cdm.depaul.edu/asettle/csc242-801/hw/lab1.html 2/3

[]
>>>

2. Write a function nameGame() that takes a list of strings representing names as a parameter and plays a guessing
game with the user. The function chooses a random name from the list and then repeatedly prompts the user to
enter a name. If the user’s entry is not the name randomly chosen by the function, the function prints a message
sharing that information with the user and continues the game. If the user’s entry matches the name chosen from
the list, the function prints a message to that effect and stops. The function should not change the name chosen
between rounds of the game. The names in the list provided as a parameter can be in any case, as can the name(s)
entered by the user during the game. The function should compare names without taking case into account, so that
names match if they have the same sequence of letters in the same order. If the list of names provided is empty, the
function simply prints a message to that effect and does not do anything else. The function should not change the
list provided as a parameter. The following shows several sample runs of the function. Note that your runs may
differ in the name chosen since the name is chosen randomly:

>>> nameGame([])
I’m sorry, but I can’t play a game with an empty list.
>>> nameGame([‘Annika’, ‘JoJo’, ‘erin’, ‘AMBER’, ‘LaRue’])
Enter your guess: ERIN
That’s not it. Please try again.
Enter your guess: jojo
That’s not it. Please try again.
Enter your guess: larue
That’s not it. Please try again.
Enter your guess: ANNIKA
You got it! Thanks for playing.
>>> nameGame([‘Sigrid’, ‘Andre’, ‘Jaime’, ‘Patty’])
Enter your guess: SIGRID
That’s not it. Please try again.
Enter your guess: jaime
That’s not it. Please try again.
Enter your guess: andRE
That’s not it. Please try again.
Enter your guess: pattY
You got it! Thanks for playing.
>>> nameGame([‘Sigrid’, ‘Andre’, ‘Jaime’, ‘Patty’])
Enter your guess: Patty
That’s not it. Please try again.
Enter your guess: andre
That’s not it. Please try again.
Enter your guess: SIGrid
That’s not it. Please try again.
Enter your guess: jaime
You got it! Thanks for playing.
>>>

Submitting the exercises

1/7/2021 Lab exercise set 1 — CSC 242-602

facweb.cdm.depaul.edu/asettle/csc242-801/hw/lab1.html 3/3

You must submit your solution to the exercises using the lab 1 dropbox on the D2L site. Submit only a single text file
(csc242lab1.py) with each of the completed functions and classes for the lab exercises in it. Submissions after the
deadline listed above will be automatically rejected by the system. See the syllabus for the grading policy.

Grading

Each lab exercise is worth 5 points for a total of 10 points. A grading rubric for the lab exercises is available.

http://d2l.depaul.edu/

http://facweb.cdm.depaul.edu/asettle/csc242-801/info/labs.html

Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.

Order your essay today and save 30% with the discount code ESSAYHELP