Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help to calculate the sum of this, i just don't know how...... file_name = input(What is the value-probability file? ) with open(file_name ,

I need help to calculate the sum of this, i just don't know how......

file_name = input("What is the value-probability file? ")

with open(file_name , "r") as final:

for numbers in final:

split_function = numbers.split()

num_one = float(split_function[0])

num_two = float(split_function[1])

final = num_one * num_two

final_line = final

So when my code runs the output looks like this :

What is the value-probability file? hw3_part2_test1.txt -0.567032 -17.630715000000002 3.194056 4.398823 13.990935

I need all these numbers now to add to the next line and next line and give me sum..

I need the output answer to be : 3.386066999999997

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions