Question

CSE 231 Fall 2019 Programming Project 05 This assignment is worth 45 points (4.5% of the course grade) and must be completedEach face of the triangle mesh is a triangle, that contains 3 vertices and 3 edges. Any two faces of the mesh are connected bHere I am asked to create a program using functions and files in python 3.7. I am unfortunately not able to use lists in the project. Thanks

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1 Python 3.7.4 (d [GCC 6.3.0 2017 def findSumOf Numbers (fileName) main.py 2 sum 0 38 input.txt 4 try: open (fileName) #read

def findSumOfNumbers(fileName):
        sum = 0
        try:
                f = open(fileName)
                # read lines of file one by one.
                for line in f:
                        # convert string to integer.
                        sum += int(line)
        except:
                print('Error in finding file', fileName)

        return sum


print(findSumOfNumbers('input.txt'))

file input.txt:
1
2
5
6
7
8
9

**************************************************
i have created a very simple program which finds the sum of numbers which are in the file.. Each line in file should have a number.

Thanks for your question. We try our best to help you with detailed answers, But in any case, if you need any modification or have a query/issue with respect to above answer, Please ask that in the comment section. We will surely try to address your query ASAP and resolve the issue.

Please consider providing a thumbs up to this question if it helps you. by Doing that, You will help other students, who are facing similar issue.

Add a comment
Know the answer?
Add Answer to:
Here I am asked to create a program using functions and files in python 3.7. I...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Exercise 2: Finite element method We are interested in computing numerically the solution to a 2D...

    Exercise 2: Finite element method We are interested in computing numerically the solution to a 2D Laplace equation u 0, The triangulated domain is given in the file mesh.mat on Blackboard. which contains the V × 2 nnatrix vertices storing the two coordinates of the vertices and a F × 3 matrix triangles in which each ro w J contains the indices in {1,····V) of the three vertices of the j-th triangle. a) Using for example MATLAB's triplot or trimesh...

  • My p1i = 6408.41640768       p2i = 4439.33266 Here is your task. Make a ...

    my p1i = 6408.41640768       p2i = 4439.33266 Here is your task. Make a diagram of the initial momentum vectors adding to the total momentum vector, �" = �W," + �:,". (This will look like the right side of your Vector Plotting diagram you did in lab.) Use the Law of Sines and the Law of Cosines to add them to find the magnitude and angle of �". Do this without switching to Cartesian vectors or making any right triangles. (You...

  • I need Summary of this Paper i dont need long summary i need What methodology they used , what is the purpose of this p...

    I need Summary of this Paper i dont need long summary i need What methodology they used , what is the purpose of this paper and some conclusions and contributes of this paper. I need this for my Finishing Project so i need this ASAP please ( IN 1-2-3 HOURS PLEASE !!!) Budgetary Policy and Economic Growth Errol D'Souza The share of capital expenditures in government expenditures has been slipping and the tax reforms have not yet improved the income...

  • summatize the following info and break them into differeng key points. write them in yojr own...

    summatize the following info and break them into differeng key points. write them in yojr own words   apartus 6.1 Introduction—The design of a successful hot box appa- ratus is influenced by many factors. Before beginning the design of an apparatus meeting this standard, the designer shall review the discussion on the limitations and accuracy, Section 13, discussions of the energy flows in a hot box, Annex A2, the metering box wall loss flow, Annex A3, and flanking loss, Annex...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT