Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Chrome File Edit View History Bookmarks People Window Help M inbox (4100 matthew

ID: 3791970 • Letter: C

Question

Chrome File Edit View History Bookmarks People Window Help M inbox (4100 matthew x SakalaURI: CSE 110 x Chegg study l Guided x Please Answer These C a Secure https://sakal.uri.edu/portalsite/e3dbb680.165 49or affo 88 96032a67 eat Algoritms u Instructions CSC 11 Homework Porthon Lists 1. Consider that you work for the Department of Transportation and they are trying to determine what percentage orars that pass a sensorata aetain wot aetraveling over the speed limit. Wrte a python program that does the following: sample code Gets the number of cars that passed the sensor. Gets the data (the list of speeds)from the user and stores itin alist Gets a speed limit from the user cscurks Computes the number of speeds that exoeed a speed limit. Prints the percentage of cars that have exceeded the speed limit. Your output will look something like this: Python 3.5.2 (v3.5.2 4def2e2getas. Jun 26 2016 47:2S) iversity Course [GCC 4.2.1 CApple Inc. build S666) Cdot 3)] darwin "credits or "license O for more informotion /Users/ dipippo/Documents/esc 1 solutions RESTART Site Info ol12016hw -1-speeding cons. py How many cars passed the sensor? S er speed ror cor 1 er speed for cor 2 Enter speed for cor 3 Enter speed for cor 4 Enter for cor What is the speed linit? 6a of cars that were speeding is 4a.a 2, write a Python program that generates a Bst of al numbers between 1 and 500 that are divisible by agven number

Explanation / Answer

Part 1: Please run them in Python 3.5

n=input("How many cars passed the sensor?: ")
n=int(n)
l=[] #empty list
for i in range(n):
temp=input("Enter speed for car "+str(i+1)+" :")
l.append(temp) #appending data to the list
limit=input("What is the speed limit: ")
count=0 #let count =0
for value in l:
if(value>limit):
count+=1 #it increaes the value of count one by onea
print("Percentage of cars that were speeding is ",count*100/n," %")

2:

n=input("Enter the number: ")
n=int(n)
l=[] #empty list
for i in range(1,501): #from 1 to 500
if(i%n==0): #if i is divisible by your number
l.append(i)

print("The resulting list is: ",l)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote