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
Oxana [17]
2 years ago
15

Design a loop that asks the user to enter a number. The loop should iterate 10

Computers and Technology
1 answer:
yarga [219]2 years ago
4 0

There are actually a couple of questions in here. I'll try to answer them in Python, which kind of looks like psuedocode already.

1. Design a loop that asks the user to enter a number. The loop should iterate 10 times and keep a running total of the numbers entered.

Here, we declare an empty array and ask for user input 10 times before printing a running total to the user's console.

<em>numbers = [] </em>

<em>for i in range(10): </em>

<em>    numbers.append(input("number: "))  </em>

<em>print(f"running total: { ', '.join(numbers) }")</em>

<em />

2. Design a program with a loop that lets the user enter a series of numbers. The user should enter -99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers entered.

Here, we declare an empty array and ask for user input forever until the user types -99. Python makes it really easy to get the min/max of an array using built-in functions, but you could also loop through the numbers to find the smallest as well.

<em>numbers = [] </em>

<em>while True: </em>

<em>    n = int(input("number: ")) </em>

<em>    if n == -99:  </em>

<em>        break </em>

<em>    numbers.append(n) </em>

<em>print(f"largest number: { max(numbers) }")   </em>

<em>print(f"smallest number: { min(numbers) }")    </em>

<em />

You might be interested in
Suppose you use Batch Gradient Descent to train a neural network and you plot the training error at every epoch. If you notice t
Phantasy [73]

Answer:

The answer is "using validation error".

Explanation:

The validation error is used to response the test for one of the queries is activated to the participant, which may not properly answer the question. These errors go up continuously after each time, the processing rate is too high and also the method is different.  

  • These errors are also unless to increase when they are actually in the problem.  
  • The training level will be that, if the learning error may not increase when the model overrides the learning set and you should stop practicing.
6 0
2 years ago
How do Brainly experts and verified users format their answers to look like this:
koban [17]

{ \dashrightarrow{ \green{ \tt{use \: the \: latex}}}} \\  \\  { \blue{ \sf{ \: refer \: to \: the \: pdf \: available}}} \\ { \blue{ \sf{at \: https : \  \:  \ \: latex \: on \: brainly}}}

3 0
2 years ago
Read 2 more answers
A restaurant chain has several store locations in a city (with a name and zip code stored for each), and each is managed by one
bazaltina [42]

Answer:

The restaurant chain system consist of restaurant id, name, zipcode, manager id, menu list.

Manager; manager id, name, phone no, and store.

Menu; menu id, type, items and description.

Items; item id, price and description.

Explanation:

Please look at the attachment for the E. R diagram.

5 0
3 years ago
When it's time to change career paths, it's a good idea to first​
yarga [219]

Answer:

Go for an interview before quitting your job.

Explanation:

You don't want to lose your job, do you? :)

8 0
3 years ago
Read 2 more answers
Recursively computing the sum of the first n positive odd integers, cont. About (a) Use induction to prove that your algorithm t
julia-pushkina [17]

The recursive function would work like this: the n-th odd number is 2n-1. With each iteration, we return the sum of 2n-1 and the sum of the first n-1 odd numbers. The break case is when we have the sum of the first odd number, which is 1, and we return 1.

int recursiveOddSum(int n) {

 if(2n-1==1) return 1;

 return (2n-1) + recursiveOddSum(n-1);

}

To prove the correctness of this algorithm by induction, we start from the base case as usual:

f(1)=1

by definition of the break case, and 1 is indeed the sum of the first odd number (it is a degenerate sum of only one term).

Now we can assume that f(n-1) returns indeed the sum of the first n-1 odd numbers, and we have to proof that f(n) returns the sum of the first n odd numbers. By the recursive logic, we have

f(n)=f(n-1)+2n-1

and by induction, f(n-1) is the sum of the first n-1 odd numbers, and 2n-1 is the n-th odd number. So, f(n) is the sum of the first n odd numbers, as required:

f(n)=\underbrace{\underbrace{f(n-1)}_{\text{sum of the first n-1 odds}}+\underbrace{2n-1}_{\text{n-th odd}}}_{\text{sum of the first n odds.}}

6 0
3 years ago
Other questions:
  • How Java provides protection through stack inspection approach ?
    7·1 answer
  • Which tasks can be completed using the Chart Tools Design tab? Check all that apply.
    9·1 answer
  • Write a program to test the various operations of the class clockType
    8·1 answer
  • Which type of NAC agent will be used during the posture assessment before allowing access to the VPN users?
    9·1 answer
  • Write 3 functions in the starter code below such that: add_to_dict(): takes a dictionary, a key, a value and adds the key,value
    15·1 answer
  • What does mean I can’t turn on my computer and my computer won’t charge at all
    15·1 answer
  • What is a fire wall and how does it work
    14·1 answer
  • Explain different types of networking-based attacks
    5·1 answer
  • 3. Rajat wants to assign green colour to a paragraph. Write the code that will help him in completing the task
    9·1 answer
  • What are the cloud storage components
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!