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]
2 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]2 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
32.
qaws [65]

Answer:

a

Explanation:

hackers access your system unauthorized

5 0
3 years ago
A cloud implementation engineer successfully created a new VM. However, the engineer notices the new VM is not accessible from a
Rina8888 [55]

Answer:

Option A.

Explanation:

Incorrect subnet is the most likely problem in this scenario.

4 0
3 years ago
What is communication​
IgorLugansk [536]

Answer:

it is when u talk to someone

6 0
3 years ago
Read 2 more answers
To copy and paste from an excel workbook to a word document, you must first
Montano1993 [528]
Highlight the items or words you are trying to copy, then right click, then click copy and then paste
6 0
3 years ago
The _____ contains the prerequisites for the new system, describes the alternatives that were considered, and makes a specific r
Step2247 [10]

Answer:

Option d

Explanation:

  • A Software Requirements Specification (SRS) is a depiction of a product framework to be created.  
  • SRS is a thorough evaluation of prerequisites before the more explicit framework configuration stages, and its objective is to decrease later upgrade. It ought to likewise give a reasonable premise to assessing item costs, dangers, and timetables.  
  • The product prerequisites detail report records adequate and vital necessities for the task advancement.
  • To infer the necessities, the designer needs to have clear and intensive comprehension of the items a work in progress.
  • This is accomplished through point by point and persistent correspondences with the venture group and client all through the product advancement process.
3 0
3 years ago
Other questions:
  • These commands are established by combatant commanders when authorized by the Secretary of Defense through the Chairman of the J
    5·1 answer
  • Why should the data in a reservation system that is constantly being updated be stored on a magnetic disk instead of a CD or DVD
    15·1 answer
  • Which statements describe OneDrive?
    10·2 answers
  • Eight what makes one character
    14·1 answer
  • A customer survey asked respondents to indicate their highest levels of education. The only three choices in the survey were hig
    15·1 answer
  • What is the turns ratio of the transformer T10261
    5·1 answer
  • When light does not pass through or bounce off an object, it is said to be
    13·2 answers
  • <br> Help me please I need the correct answe
    10·1 answer
  • Write a program in python to make the figure:-
    12·1 answer
  • The method used to transfer information to far off place instantly is called​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!