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
tangare [24]
3 years ago
8

Lists and Procedures Pseudocode Practice For each situation, provide a pseudocoded algorithm that would accomplish the task. Mak

e sure to indent where appropriate. Situation A Write a program that: Takes the list lotsOfNumbers and uses a loop to find the sum of all of the odd numbers in the list (hint: use Mod). Displays the sum. Situation B Write a procedure that takes
Computers and Technology
1 answer:
Andrei [34K]3 years ago
6 0

Answer:

The pseudocoded algorithm is as follows:

Procedure sumOdd(lotsOfNumbers):

    oddSum = 0

    len = length(lotsOfNumbers)

    for i = 0 to len - 1

         if lotsOfNumbers[i] Mod 2 != 0:

              OddSum = OddSum + lotsOfNumbers[i]

Print(OddSum)

Explanation:

This defines the procedure

Procedure sumOdd(lotsOfNumbers):

This initializes the oddSum to 0

    oddSum = 0

This calculates the length of the list

    len = length(lotsOfNumbers)

This iterates through the list

    for i = 0 to len-1

This checks if current list item is odd

         if lotsOfNumbers[i] Mod 2 != 0:

If yes, the number is added to OddSum

              OddSum = OddSum + lotsOfNumbers[i]

This prints the calculated sum

Print(OddSum)

You might be interested in
Write the definition of a function named timeOnHighway that receives three parameters, all of type double: mileEndingPoint , mil
dybincka [34]

Answer:double timeOnHighway (double mileEndingPoint, double mileStartingPoint = 0.0, double speed = 55.0)

return (mileEndingPoint - mileStartingPoint) / speed

Explanation:

6 0
4 years ago
What should I change my fortnite name to:<br> Barneys broken thumb or I dont have aim assist
Ket [755]

Answer: yes

Explanation:

4 0
3 years ago
Write a function add_spaces(s) that takes an arbitrary string s as input and uses recursion to form and return the string formed
kvasek [131]

Answer:

The solution code is written in Python:

  1. def add_spaces(s):
  2.    if len(s) < 2:
  3.        return s  
  4.    else:
  5.        return s[0] + " " + add_spaces( s[1 : ] )

Explanation:

Recursive function is a function that will call itself within the same function.

Let create a function named add_spaces() that take one input string, s (Line 1).

Next, create an if condition to check if the length of the input string is less than 2 (this means if the string has only one character), return the current string (Line 2-3).

Otherwise, it should return the first character of string, s[0] concatenated with a single space " " and concatenated again with the return output from the recursive calling add_spaces() that take s[1: ] as input parameter (Line 4-5). Please note s[1: ] is an expression we get the substring of the current string from position 1 till the end of string.

5 0
3 years ago
Read 2 more answers
What are two characteristics of switches? (Choose two.) * 1 point A. Switches identify the intended destination of the data that
tigry1 [53]

Answer:

A. Switches identify the intended destination of the data that they receive. And C. Switches are capable of sending and receiving data at the same time

Explanation:

Switches can be used as inputs (Analog), or outputs (digital). These inputs and outputs are signals that the switches send or receive- Or at least as push button switches... But the same applies to network switches.

Hope this helps! Have a great day!

7 0
3 years ago
Jack is assisting his younger sibling Mary with her mathematics assignment, which includes a study of the number system. Jack ex
Elza [17]

Answer:

The answer is A). Integers

Explanation:

Booleans and Strings don't represent numbers (in most cases) so they can be eliminated.

Floats are used for representing decimals while integers are used for whole numbers.

4 0
3 years ago
Read 2 more answers
Other questions:
  • ______________is a collection of technologies for abstracting the details of how applications, storage, network, and other compu
    6·1 answer
  • When paying bills online, a payee is:
    9·1 answer
  • Storage that is wiped clean when power is cut off from a device is known as _____.
    13·1 answer
  • Write a program that outputs inflation rates for two successive years and whether the inflation is increasing or decreasing. Ask
    9·1 answer
  • Which line of code outputs the decimal portion of a float stored in the variable x? print (x % 1000) print (x) O print (x / 1000
    13·1 answer
  • Which shooting games is good for low end PC. CSGO or Valorant?​
    11·1 answer
  • Why Do You Need to Set Goals for a LinkedIn Automation Campaign?
    15·1 answer
  • Fill this blanks with the given words​
    6·1 answer
  • What is meant by a balanced budget?
    8·1 answer
  • What does the sign (#) mean in manuscript edpm<br> and also what does (DEL)
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!