Question Description
Q1:
calculate 120 credits to graduate in Python coding
1. Input = Number of credits taken
2. Calculate: 120 – Input
3. Print a statement “You need XXX credits to graduate.”
Q2:
Write the following program.
1. Create a class for Music and the parameters are genre (for example, pop, rock, classical, jazz) and recording medium (for example, digital, cd, record)
2. Create a child class for musicians; the parameters would include: artist name, song, song release date
3. Create two instances from the child class (you can make up the data for this instance)
4. Print a sentence for each instance that says: “My favorite {genre} song from {artist name} is {song} released in {date} on {medium}.”
Q3:
Debug and put the correct answer in colab. Label this Question 16 in colab.
prompt = “nWhat is one of your favorite numbers:”
prompt = “nIf you would like to stop enter quit.”
while True:
number = input(prompt)
if number = ‘quit’
break
else: print(“What is another of your favorite number:”)
Q4:
Prompt = “nPlease enter what you would like to order: “
Prompt += “n(Enter ‘done’ if you are finished with your order.)”
while True:
Meal == imput(prompt)
if meal = ‘done’
break
else: print(F”You would like to order {meal.title()}.”)
Q5:
create a txt file called dog.txt (Some examples could be: poodle, lab, collie, sheltie, pitbull)
Fix this code-
filename = ‘dog.txt’
with open(filename) as dog.object
for dog in dog.object
print(dog.rstrip())