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
jolli1 [7]
3 years ago
14

2. Write a standalone function partyVolume() that takes accepts one argument, a string containing the name of a file. The object

ive of the function is to determine the a Volume object that is the result of many people at a party turning the Volume up and down. More specifically:
Computers and Technology
1 answer:
laiz [17]3 years ago
8 0

Answer:

The Python code is given below with appropriate comments

Explanation:

#required method, assuming Volume class is defined and is accessible

def partyVolume(filename):

   #opening file in read mode, assuming file exists

   file=open(filename,'r')

   #reading initial volume

   initial=float(file.readline())

   #creating a Volume object with initial volume

   v=Volume(initial)

   #looping through rest of the lines in file

   for line in file.readlines():

       #removing trailing/leading white spaces/newlines and splitting line by white

       #space to get a list of tokens

       line=line.strip().split(' ')

       #ensuring that length of resultant list is 2

       if len(line)==2:

           #reading first value as direction (U or D)

           dir=line[0].upper()

           #reading second value as float value

           value=float(line[1])

           if dir=='U':

               #turning volume up

               v.up(value)

           elif dir=='D':

               #turning volume down

               v.down(value)

   #closing file, saving changes

   file.close()

   #returning volume

   return v

You might be interested in
a rule that states each foreign key value must match a primary key value in the other relation is called the
makvit [3.9K]

Answer:

Referencial Integrity Contraint

Explanation:

The referential integrity constraint states that the customer ID i.e (CustID) in the Order table must match a valid CustID in the Customer table. Most relational databases have declarative referential integrity. That is to say, when the tables are created the referential integrity constraints are set up so as to maintain the quality of information.

3 0
3 years ago
What does xhtml stand for?
igomit [66]
Extensible Hypertext Markup Language.
3 0
3 years ago
Read 2 more answers
Defeating authentication follows the method–opportunity–motive paradigm.
sashaice [31]

Answer:

Method:- This is related to hackers technique and way of accessing to copy other data. It also includes the skill, knowledge, tools and other things with which to be able to pull off the attack.

Opportunity:- this is related to how a user gives way to access to the hackers. It includes the time, the chance, and access to accomplish the attack.

Motive:- This may relate to the hacker to destroy the reputation of another or for money. It is reason to want to perform this attack against this system

3 0
3 years ago
The code selection above is taken from the Color Sleuth activity you just completed. This selection would count as an abstractio
Vinvika [58]

Answer:

b

Explanation:

4 0
3 years ago
When driving, your attention is __________.
maks197457 [2]
It is c hope I helped
7 0
3 years ago
Read 2 more answers
Other questions:
  • Identify requirements that should be considered when determining the locations and features of firewalls. What are some importan
    5·1 answer
  • An option button is a square button that enables you to make one choice among two or more options.
    15·1 answer
  • Which of the following statements invokes the GetDiscount function, passing it the contents of two Decimal variables named decSa
    8·1 answer
  • HELP ASAP
    9·1 answer
  • Quiz
    6·2 answers
  • Consider the following C++ program in which the statements are in the incorrect order. Rearrange the statements so that itprompt
    6·1 answer
  • Describe the best way to deal with a difficult co-worker?
    13·2 answers
  • ? Question
    6·2 answers
  • dam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took to get the correct
    9·1 answer
  • The World Wide Web Click on a Description on the left, then click the Term that best fits the Description. Description Technolog
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!