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
Marianna [84]
3 years ago
8

Write a shell (text-based) program, called sum_second.py, that opens a text file called stuff.txt with 2 numbers per line separa

ted by commas and prints out the sum of the second numbers on every line. For example, if stuff.txt has the following lines: 500,55 300,45 200,7 400,20 Then the following example output would happen. PS C:\Users\ssiva\Desktop> python sum_second.py Sum: 127 PS C:\Users\ssiva\Desktop>

Computers and Technology
1 answer:
Ivanshal [37]3 years ago
6 0

Answer:

See explaination for the program code

Explanation:

The Programming code:

inFile = open("stuff.txt", "r")

num = []

Sum = 0

for val in inFile.readlines():

value = val.split(",")

Sum = Sum + int(value[1])

print("Sum of second number on every line in the file is: ", Sum)

inFile.close()

Please kindly check attachment for output

You might be interested in
A restaurant bill comes to $28.35. Find the total cost if the tax is 6.25% and a 20% tip is left on the amount before tax.​
Salsk061 [2.6K]

Not sure how this is computers and technology

3 0
3 years ago
What is a constructor? Why would you include a constructor in a class?
QveST [7]

Answer:

Constructor in the class is the member function that gets into action when any new object gets created in the class ,it gets invoked. It does not have any return type and no void return.

The constructor is used in the class because there is the requirement for the initializing of the new object and then only object can do the functioning in the program.

4 0
3 years ago
According to the reading on the course web pages, the earliest usage of cooking began around _____ million years ago.
fenix001 [56]

Answer:

According to the reading on the course web pages, the earliest usage of clothes began around ____ million years ago. 3.4 1.5 0.8 0.5 1.7 2. According to the reading on the course web pages, lime mortar was probably discovered from annealing: Charcoal Obsidian Flint Glass 3.

Explanation:

6 0
3 years ago
.WAP to enter monthly sale of Salesman and give him commission i.E. If the monthly sale is more than 500000 then commision will
nexus9112 [7]

sales = float(input("Enter monthly sales amount: $"))

commission = 0.05

if sales> 500000:

   commission = 0.1

print("You earned: $"+str(sales*commission))

I wrote my code in python 3.8. I hope this helps.

5 0
3 years ago
Your license can be canceled if you __________
Elena L [17]
Its B i think hope this helps ! 
8 0
3 years ago
Read 2 more answers
Other questions:
  • Which line of code will generate a random integer between 7 and 77?
    10·1 answer
  • In which area of engineering does material selection play a vital role a design optimization b forensic engineering c mechanical
    6·1 answer
  • If your vehicle catches fire while you are driving, you should:
    5·2 answers
  • Describe one type of technology that is useful in producing images from space.
    9·1 answer
  • Use induction on n to prove that fir all n>=2, 2^n+3^n<5^n
    11·1 answer
  • More recent GPU families such as Fermi and Kepler have adopted CPU-style virtual memory architecture with a____________-bit virt
    8·1 answer
  • Which of the following statement about CAD is NOT true A. It increase the productivity of designers B. It uses computer graphics
    8·1 answer
  • What is the "online disinhibition effect"?​
    7·1 answer
  • Note oj cyber security​
    6·1 answer
  • Mha lovers why do other anime lovers report mha lovers for not liking there anime?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!