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
Eduardwww [97]
3 years ago
13

Write a program that loops one thousand times. add all the even numbers and display the results. add all the odd numbers and dis

play the results.
Computers and Technology
1 answer:
tekilochka [14]3 years ago
5 0
# Python v3

odd = 0
even = 0

for i in range( 1000 ): # Note: zero indexed!
    if( i % 2 ):
        even += i
    else:
        odd += i

print( "The even numbers add up to %d" % even )
print( "The odd numbers add up to %d" % odd )
You might be interested in
This is your chance to become the instructor. After learning the looping and input validation concepts, create a problem to give
enot [183]

Answer:

See Explaination

Explanation:

The Problem information is as follows:

The input: A data file containing the bank account information.Accounts are of different

types (like Savings Account, Checking Accounts).

The Output: Report on Number of Savings Account, Number of Checking accounts and their

total balances, avregae balance, maximum and minimum balance etc

Processing:

Read the file data

Consider valid account data

Separate different accounts

Calculate the sum of their balances

Calculate the average balnace for each type of account

Display the information

Solution:

1.The application should be able to read the csv file.

2.All the error checking should be done as per defined rules

3.The report should be generated in the defined format

4.Data display precisions need to be followed.

5.Interactive errors should be reported with proper messages

6.Integrity of the data should be maintaied while saving the data.

7. Calculation of the averageAccountBalance = (Sum of all the balances of a particular type of account)/(number of that type of account)

8. TotalAccountBalance = Sum of all the balances of each type of account.

9. To find maximum start with a default value and then traverse all the accounts and update the maximum value as per the comparison results

and same for minimum.

Input Validation:

1.Check for the filename (maximum length is 10 chars besides the csv extension)

2.account number (12 digits, first three entries are alphabets)

3.Name (Only alphabets are allowed)

4.Phone Number (7 digits must follow the format xxx-xxx-x)

pesudoCode:

Input filename

open the file

declare accounts[] array

Read the data in accounts and update numOfAccounts

declare numOfAccounts, numOfSavingActs, numOfCheckingActs, totalBalanceSavings, totalBalanceChecking, averageBalanceChecking

averageBalanceSavings, maximumSaavings, minimumSavings, maximumChecking, minimumChecking

for i = 1 to n:

if (Validate(account[i])):

if account[i].type == "Savings":

numOfSavingActs++

totalBalanceSavings = totalBalanceSavings + account[i].balance

if account[i].balance > maximumSavings:

maximumSavings = account[i].balance

if account[i].balance < minimumSavings:

minimumSavings = account[i].balance

if account[i].type == "Checkings":

numOfSavingActs++

totalBalanceSavings = totalBalanceSavings + account[i].balance

if account[i].balance > maximumSavings:

maximumSavings = account[i].balance

if account[i].balance < minimumSavings:

minimumSavings = account[i].balance

Display(Data)

4 0
2 years ago
Which one of the following items is an example of software?
Harlamova29_29 [7]
Word processing program is an example of a software. All the others, such as Printer, Keyboard and Mouse are examples of Computer peripheral devices or in short hardware devices. Generally these listed hardware devices come under input or output computer device category. Also, by classic meaning in layman terms these hardware components can be touched or felt. In contrast, a word processing program is a part of a computer system that consists of data or computing instructions and provides the mechanism to computer to perform a certain task utilizing it's hardware resources. Such components of computer system which are written using one of the computer languages are called computer software or software programs or simply software.
4 0
3 years ago
From your computer you are able to establish a telnet connection to a remote host but a traceroute to the host IP address result
Tanya [424]

Mostly firewalls may protect trace route to the host IP address.

<u>Explanation:</u>

When telnet has established the connection to a remote host. Then kindly check the host IP address and their gateway settings.  

If any resident firewall such as antivirus is stopping the ping method or gate way firewall is protecting both ends during trace route. Once the connection is established don’t worry about trace route on host IP  address.

Kindly check where the disconnections happens during the trace route.  in case it happens in between then they're stability on the connection issue which should be solved immediately.

8 0
2 years ago
To make a complicated task easier, use a _____.
tia_tia [17]
I believe the answer is B spread sheet because i use spread sheets to make my life easier. I organize info in a spread sheet then it is really easy to find.

hope this helps<span />
6 0
2 years ago
Any single girls 12-14 im a 13 yo boy idc if this aint a dating site
-BARSIC- [3]

Answer:

THIS AN'T DATING APP

Explanation:

THIS IS THE ONE THE ONLY

BRAINY

5 0
2 years ago
Read 2 more answers
Other questions:
  • All of the following are stages in the SDLC except _____.
    9·1 answer
  • If there are no differences between the amino acid sequences in the cytochrome c protein of humans and chimpanzees why aren't we
    15·1 answer
  • Write a Console Java program that asks the user to enter one sentence on the keyboard. Output on the console:
    6·1 answer
  • Encyclopedia.com is considered to be
    15·1 answer
  • Who is the founder of javascript? ​
    14·2 answers
  • 5. Which of the following views is used to run a PowerPoint presentation?
    11·2 answers
  • How do I modify objects in power point 2016 for an assignment
    11·1 answer
  • You want a cable that could be used as a bus segment for your office network. The cable should also be able to support up to 100
    5·1 answer
  • You are writing a program to help compare two sports teams. A sample member of the list scores is [2. 5] where your team scored
    5·2 answers
  • What feature is available to add a auggestion in the margin of someone else's document.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!