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
3.5 lesson practice quiz Edhesive
erik [133]

Answer:

                                                                                     

Explanation:

6 0
2 years ago
Read 2 more answers
Which of the following statements is false? Question 4 options: By convention class names begin with an uppercase letter, and me
amm1812

Answer:

Instance variables can be declared anywhere inside a class.

Although there isn't any rule to declare instance variables before methods, and they can be declared anywhere in the class, they cannot be declared inside method definitions of class.

///////////////////////////////////////////////////////////////////////////////////////////////////////////

<em>By convention class names begin with an uppercase letter, and method and variable names begin with a lowercase letter.</em> - True.

<em>Instance variables exist before methods are called on an object, while the methods are executing and after the methods complete execution.</em> - True.

<em>A class normally contains one or more methods that manipulate the instance variables that belong to particular objects of the class.</em> - True

8 0
3 years ago
Read 2 more answers
1. It is a set of integrated devices that input, output,
grin007 [14]

Answer:

A

Explanation:

Program system and software canot pulg in

4 0
2 years ago
A short
alexandr402 [8]

Explanation:

Java Bitwise Operators

Operator Description Example

>> (right shift) Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand. A >> 2 will give 15 which is

8 0
3 years ago
Which program can damage your computer? can cause damage to my computer.
svetlana [45]

Answer:

Malware is designed to cause damage to a stand alone computer or a networked pc. So wherever a malware term is used it means a program which is designed to damage your computer it may be a virus, worm or Trojan.

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • A type of memory that is expensive and therefore is often used only in cache memory applications.
    15·2 answers
  • What is structured​ knowledge?
    10·1 answer
  • Which words in the sentence make up the adjective phrase? Which word does the adjective phrase modify? The farmer delivers five
    15·1 answer
  • Which statement reflects an opinion about technology? Select all that apply. Select one or more: a. It is easy to imagine that a
    5·1 answer
  • Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 38 then the outpu
    11·1 answer
  • Often technical personnel who are not familiar with security techniques think that restricting access to ports on a router or fi
    5·1 answer
  • What does it mean if my ninja blender power light is blinking?
    13·2 answers
  • (main.c File)
    7·1 answer
  • PLEASE HELP AND FAST!!!!!<br>Which of the following devices uses binary code?
    6·2 answers
  • Choose all items that represent examples of good website accessibility.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!