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
Write a MATLAB program to accomplish the following: Create two vectors, a and b, where vector a contains all positive integers l
sattari [20]

Answer:

Explanation:

Below is the complete MATLAB code that performs the given operations.

a = 10:10:99 % Generating first vector

b = 2:2:18  % Generating 2nd vector

c = rdivide(a,b) % Dividing vector a by b and storing in c

d = times(c,c) -19 % Subtracting 19 from each element of vector c

c % Displaying value of c

d % Displaying value of d

Output screenshot

C =

 5 5 5 5 5 5 5 5 5

d =

6 6 6 6 6 6 6 6 6

3 0
3 years ago
Which PowerPoint options can users customize?
Zielflug [23.3K]

Answer:

Customized Toolbar,  theme, design, autosave file location, ribbon tabs and groups, quick access buttons, username

Explanation:

5 0
3 years ago
Write a program that generates 100 random numbers and keeps a count of how many of those random numbers are even and how many of
Anvisha [2.4K]

Answer:

import random

numbers = []

even = 0

odd = 0

for i in range(100):

   numbers.append(random.randint(1, 200))

for i in range(100):

   if numbers[i] % 2 == 0:

       even += 1

   else:

       odd += 1

print("Even:", even)

print("Odd:", odd)

Explanation:

Gg ez.

8 0
2 years ago
3.5 Code Practice: Question 1 edhesive
klio [65]

Answer:

x = int(input("What grade are you in? "))

if(x == 9):

  print("Freshman")

 

elif(x == 10):

  print("Sophomore")

 

elif(x == 11):

  print("Junior")

 

elif(x == 12):

  print("Senior")

 

else:

  print("Not in High School")

Explanation:

4 0
3 years ago
A technician has been notified of a problem on the network. After investigation, the technician determines that a specific inter
bogdanovich [222]

Answer:

Virus is a type of malware which is used in this case.

Explanation:

7 0
3 years ago
Other questions:
  • Learning about public speaking can help improve your ________________.
    15·1 answer
  • The section called Breaking Substitution Ciphers (p. 166) describes a "random substitution cipher," in which each letter of the
    11·1 answer
  • Powerpoint assumes that the first slide in a new presentation is the
    10·1 answer
  • Refer to the exhibit. the gigabit interfaces on both routers have been configured with subinterface numbers that match the vlan
    11·1 answer
  • Imagine you are a toy designer. How would you use measuring, dimensions, volume, and surface area information to create your toy
    10·2 answers
  • Give 4 examples of mnemonic codes, and what do they do?
    15·1 answer
  • What are the services offered by web-based email?​
    12·1 answer
  • The ___ function can be entered by clicking the cell where you want to add the funtion such as cell J6. Then click the arrow nex
    6·1 answer
  • Importance of folders on a computer <br>​
    10·1 answer
  • Find 10 real world challenges and their corresponding solutions
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!