1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vova2212 [387]
2 years ago
13

A list named parking_tickets has been defined to be the number of parking tickets given out by the city police each day since th

e beginning of the current year. (Thus, the first element of the list contains the number of tickets given on January 1; the last element contains the number of tickets given today.)
Write some code that associates most_tickets with the largest value found in parking_tickets. You may, if you wish, use one additional variable , k.
Computers and Technology
1 answer:
Murrr4er [49]2 years ago
5 0

Answer:

The needed code is highlighted from the current text. The rest of the code is for the simplicity purpose and to show the functionality of the logic that is used to find the most of the tickets sold till date.

Please do go through it

Explanation:

# import the required packages

import datetime

import random

# define the parking_tickets

parking_tickets = []

# set the 1'st day of the year in d1

d1 = datetime.datetime(2016,1,1)

# set the current day

d2 = datetime.datetime.now()

# calculate number of days till date

totalDays = (d2-d1).days

# fill the number of tickets sold each day randomly

# into the parking_tickets till date

for i in range(totalDays):

    randValue = random.randint(1, 100)

    parking_tickets.append(randValue)

# print the list of tickets sold in each day

print("The list of tickets sold over starting from January 1 to till day are: \n",parking_tickets)

# the required actual code

# define a variable to hold the most of the tickets sold

most_tickets = 0

# logic to find the tickets that sold the most

for k in range(len(parking_tickets)):

    # condition to check most_tickets value is lesser than

    # parking_tickets at index k(each day)

    if most_tickets < parking_tickets[k]:

         # if it is less than the parking_tickets at index k

         # then set the value to the most_tickets

         most_tickets = parking_tickets[k]

# print the most tickets sold

print("Most of the tickets that are sold with in date is ", most_tickets)

You might be interested in
What is the role of computer in the field of education​
kompoz [17]

Answer:

computer means a technology or digitalized form of technology which makes student life better by giving solution to the problem and promote creativenes.

3 0
3 years ago
Which option describes a systematic error in measuring in the following scenario?
katrin [286]

Answer:

D - The patient’s weight is inaccurate due to the calibration of the scale.

Explanation:

if feel like it is but i'm not 100% sure, sorry if not right answer ( also taking the assignment )

7 0
2 years ago
An example of financial irresponsibility
Nady [450]

An example of financial irresponsibility is driving without car insurance. The other options are examples of financial responsibility.

3 0
3 years ago
What is civil construction?
sasho [114]
Civil construction is any construction in a society that belongs to the group of core infrastructure such as <span>pipelines, telecommunications, sewers, water treatment systems, highways, roads, bridges etc.</span>
6 0
3 years ago
Write a class definition line and a one line docstring for the class Dog. Write an __init__ method for the class Dog that gives
Viefleur [7K]
Python Code:

class Dog:
""" Dog class definition """

# data attribute species as part of the class Dog
species = "Canis familiaris"

def __init__(self, _name, _breed):
""" Constructor """
# Assigning values
self.name = _name
self.breed = _breed
self.tricks = []

def teach(self, trick):
""" add a passed string parameter to tricks """
# Adding to list
self.tricks.append(trick)
# Printing message
print(self.name + " knows " + trick)


def knows(self, chkStr):
""" check whether a passed string parameter is in the dog’s list of tricks """
# Checking in tricks list
if chkStr in self.tricks:
# Printing message
print("Yes, " + self.name + " knows " + chkStr)
else:
# Printing message
print("No, " + self.name + " doesn't know " + chkStr)
4 0
2 years ago
Other questions:
  • Into which of these files would you paste copied information to create an integrated document? A. Mailing list B. Source C. Data
    13·2 answers
  • Most languages allow a specialized selection structure called the ____ structure when there are several distinct possible values
    8·1 answer
  • You have found statistics on the Internet that you would like to use in your speech.
    6·1 answer
  • Consider a situation where we have a file shared between many people.  If one of the people tries editing the file, no other pe
    6·1 answer
  • Someone help me please
    9·1 answer
  • While speech recognition can operate without any confi guration, you can train it to more accurately recognize your voice. true
    5·1 answer
  • ______ is the code that a user writes in order to create a document to display on the web
    6·1 answer
  • BIOS has two jobs. One is to boot up, or start, the computer. What is the other? Maintain the computer’s software firewall. Ensu
    5·1 answer
  • What is GIGO ?<br>plz answer me​
    7·1 answer
  • Please help me please it's urgent​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!