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
Which of the following is NOT a major feature of safety and health programs? A. Assess cultural costs B. Hazard prevention and c
aleksandrvk [35]
A. assess cultural costs. they wont help anyone if they have a safety or health issue. hope this helped

8 0
3 years ago
Complete the function to return the factorial of the parameter using recursion.
Klio2033 [76]

def recursiveFactorial(number):

   if number > 1:

       return number * recursiveFactorial(number-1)

   else:

       return 1

stringNum = input("Enter a positive integer: ")

num = int(stringNum)

print(recursiveFactorial(num))

7 0
3 years ago
Someone to explain one by one of the 7 C's in communication skills​
antiseptic1488 [7]

Answer:

clear)

be clear about the purpose of the message you’re delivering.

concise)

When communicating messages of this nature it’s important to stick to the point and keep your messages short and simple.

concrete)

When shaping your communication you must ensure that you are specific and that the logic and messages that you’re using fit together, build on each other and support each other.

correct)

It’s essential that both the factual information and the language and grammar you use are correct.

coherent)

If your communications are not coherent they will not be effective.

complete )

When creating a message, it’s important to give the recipient all of the information they need to follow your line of reasoning and to reach the same conclusions you have.

courteous)

You can increase the effectiveness of your communications by being polite and showing your audience that you respect them.

Explanation:

6 0
3 years ago
380<br> 787<br> What is380+787=
nignag [31]
The awnser is 1167 ..
7 0
3 years ago
Read 2 more answers
Create a recursive procedure named (accumulator oddsum next). The procedure will return the sum of the odd numbers entered from
maks197457 [2]

Answer:

Explanation:

The following procedure is written in Python. It takes the next argument, checks if it is an odd number and if so it adds it to oddsum. Then it asks the user for a new number from the keyboard and calls the accumulator procedure/function again using that number. If any even number is passed the function terminates and returns the value of oddsum.

def accumulator(next, oddsum = 0):

   if (next % 2) != 0:

       oddsum += next

       newNext = int(input("Enter new number: "))

       return accumulator(newNext, oddsum)

   else:

       return oddsum

8 0
3 years ago
Other questions:
  • What is a locally stored url, or the address of a file or internet page saved as a shortcut?
    10·1 answer
  • In a client/server architecture, an optional _____ is sometimes used to pass bulk information to the server. a. request line b.
    8·1 answer
  • Riodic Table
    6·1 answer
  • Write two scnr.nextInt statements to get input values into birthMonth and birthYear. Then write a statement to output the month,
    10·1 answer
  • Which of the following is a function of the slip yoke used on a driveshaft?
    14·1 answer
  • What is the deffirentiates in organs from tissues
    11·1 answer
  • What is Moodle in information communication and Technology?​
    5·1 answer
  • What is the highest strength for the leviathan axe in god of war
    10·2 answers
  • Why is computer called information processing machine ?????​
    6·2 answers
  • A switch to kernel mode, wherein the operating system performs some action before returning control to the originating process?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!