Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8141791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:37:48+00:00 2026-06-06T12:37:48+00:00

I am new to Python and wanted to read a file, which has even

  • 0

I am new to Python and wanted to read a file, which has even count of numbers, (say 20) numbers like

100
200 
59
78
...
590
13

I want to read them and compute division result of val[11]/val[1], val[12]/val[2] etc. Would you please help me. Or any other language you could suggest where it would be fast. Thanks a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:37:50+00:00Added an answer on June 6, 2026 at 12:37 pm

    Ok, this will get you just started with the basics, but you’ll have to figure out the logic of your math, the various index values, and order of operations to solve your problem.

    This simply opens a file and displays its contents. The data is read as strings, and converted to floats so that you can do math with the numbers.

    I strongly recommend you read a Python tutorial, or better yet work in a programming language you are more familiar with.

    with open('data.txt') as f:
        data = f.readlines()
        for i in range(len(data)):
            result = float(data[i])
            print result
    

    Contents of data.txt

    100
    200 
    59
    78
    590
    13
    

    The rest is up to you. Please feel free to come back and ask for help when you get stuck with a specific problem.

    Finally, since the data from the file ends up in a variable name data which is a Python list, reading through these Python docs and this tutorial should be helpful in understanding this data structure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some binary data which has a corresponding map file which identifies each
I'm new to python and wanted to do something I normally do in matlab/R
I'm new to python and django but wanted to start following some tutorials. I
I'm new to Python, and I wanted to make sure that I overrode __eq__
I'm new to PyQt though I know python a bit.. I wanted to Qt
So basically im new to python and programming in general. I was wondering say
So basically im new to python and programming in general. I was wondering say
I'm very new to python, and I wanted to compile my code into a
I am new to Python and new to SciPy libraries. I wanted to take
i am new to network programming in python. I wanted to know that what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.