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
tester [92]
3 years ago
9

A file named numbers.txt contains an unknown number of lines, each consisting of a single positive integer. Write some code that

reads through the file, ignoring those value that are not bigger than the maximum value read up to that point. The numbers that are NOT ignored are added, and their sum stored in a variable called runsum.
Computers and Technology
1 answer:
Reptile [31]3 years ago
8 0

Answer:

  1. with(open("numbers.txt")) as file:
  2.    data = file.readlines()  
  3.    runsum = 0
  4.    largest = 0
  5.    
  6.    for x in data:
  7.        if(int(x) > largest):
  8.            largest = int(x)
  9.            runsum += largest  
  10.    
  11.    print(runsum)

Explanation:

The solution code is written in Python 3.

Firstly, open a filestream for numbers.txt (Line 1) and then use readlines method to get every row of data from the text files (Line 2).

Create a variable runsum to hold the running sum of number bigger than the maximum value read up to that iteration in a for loop (Line 3).

Use a for loop to traverse through the read data and then check if the current row of integer is bigger than the maximum value up to that point, set the current integer to largest variable and then add the largest to runsum (Line 6 - 9).

At last display the runsum to console terminal (Line 11).

You might be interested in
A web ______ is a computer that delivers requested webpages to your computer or mobile device.
Goshia [24]
I believe that the answer you are looking for is a Web Server.
7 0
3 years ago
The photo shows a group of girls reacting to comments they have read about a classmate on a social media site.
shepuryov [24]

Answer:

no

Explanation:

beacuse

3 0
2 years ago
PLEASE HELPPPPP ASAP, 50 POINT'S + BRAINLIEST
vagabundo [1.1K]

Answer:

1. Cybercrimes are online crimes that cause loss of money some examples are: Identity fraud, Cyber bribery, Debit/credit card fr/ud, and Email fr/ud.  

2. In medical offices devices linked to CT scans are able to be h/cked, there is r/nsomw/re that uses their devices. Since medic/l computers are always linked to the internet. it makes it easier for them to be h/cked. They make an employee click on an e-mail carrying m/lw/re, then the cybercrimin/ls encrypt p/tient data then dem/nd p/yment for its decryption.

3. This is a personal question but if you have ever been sc/mmed or witnessed someone being sc/mmed or almost got  sc/mmed it might apply to this question

6 0
3 years ago
The ________ is an area where you can position fields to use for filtering the PivotTable and thereby enabling you to display a
Studentka2010 [4]

Answer: FILTERS area

Explanation: PivotTable is the kind of a tool that is used for the calculation of the data by analyzing ,summarizing ,comparing it according to the pattern and the sequence of the data.In this this tool. filter is used as the component for the filtering of the data in small/minor unit by analyzing it deeply. Different filter techniques is used in analyzing of the spreadsheet in PivotTable.

3 0
2 years ago
List and explain three ways study groups benefit your learning.
SashulF [63]

Answer:

Studying in groups can have many effective outcomes and be beneficial. Here are some ways studying in a group is benefical,

1.  More support, limits chances of procrastination

<u>      With many people, everyone is assigned a role or there is more determination by all peoples to get the work done than an individual being the only one responsible than many trying to accomplish the completion of the project. </u>

2. More people means more parts can get done effectively and taking notes is easier.

<u>      More people allow the work (depending on the project of assignment) for the work to get more focused and worked on faster with the designated roles given. </u>

3. More interactive and allows (sometimes an enjoyable times) and to even learn faster than independently.

      People, not all however, might like the company, there's support and even people skills is enhanced by being in the group.

3 0
2 years ago
Other questions:
  • When looking through the documentation for a specific class, you never actually see the source code for that class. Instead, you
    6·1 answer
  • Which one of the following, in addition to disciplinary programs and drug-testing, can employers misuse as a form of retaliation
    8·1 answer
  • Implement the RC4 stream cipher in C++. User should be able to enter any key that is 5 bytes to 32 bytes long. Be sure to discar
    7·1 answer
  • To rotate text in a cell select the option in the alignment grouping
    9·2 answers
  • What function returns a line and moves the file pointer to the next line?
    9·1 answer
  • What is a characteristic of tasks in Outlook?
    10·2 answers
  • How many cubic millimeters are present in 0.0923 m3?​
    14·1 answer
  • What is a word processing program? Give examples of word processing programs.
    10·1 answer
  • What’s cloud-based LinkedIn automation?
    14·1 answer
  • Which of the following items in the folder window allows users to view locations which have been visited before?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!