Question
Write a code in phyton for PART 3. Part 3: Bring in your subscribers In this part of the project, youll compute how much time
Write a code in phyton for PART 3.
Part 3: Bring in your subscribers In this part of the project, youll compute how much time your subscribers spent watching your videos.
Ask the user to tell you how many subscribers your channel has.
For each subscriber, randomly choose one of the videos in your channel (its ok to choose the same video multiple times) to have them watch.
Show the total amount of time spent between all the videos that all subscribers watched, as well as which videos were watched by your subscribers (dont show duplicated here!).
Write a code in phyton for part 3.
Part 1 and 2 is shown below.
print("Part 1 ")
videos = []
while True: title = input("Enter the title of the video (or type 'quit' to quit): ") if title == 'quit': break videos.append(title)
print(" Titles in the channel:") for title in videos: print(title) video_lengths = []
print("Part 2")
for title in videos: length = float(input("Enter the length (in minutes) of the video '" + title + "': ")) video_lengths.append(length)
shortest_length = min(video_lengths) longest_length = max(video_lengths) average_length = sum(video_lengths) / len(video_lengths)
print("Shortest video length: {:.1f} minutes".format(shortest_length)) print("Longest video length: {:.1f} minutes".format(longest_length)) print("Average video length: {:.3f} minutes".format(average_length))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started