Section 1
.pdf
keyboard_arrow_up
School
Southern New Hampshire University *
*We aren’t endorsed by this school
Course
140 - X625
Subject
Computer Science
Date
Apr 3, 2024
Type
Pages
2
Uploaded by DeaconCaterpillar4154 on coursehero.com
Students:
Section 1.2 is a part of 1 assignment:
1-3 zyBooks Participation Activities
Includes:
PA
1.2 Programming using Python
Python interpreter
The Python interpreter
is a computer program that executes code written in the Python programming language. An
interactive interpreter
is a program that allows the user to execute one line of code at a time.
Code
is a common word for the textual representation of a program (and hence programming is also called coding
). A
line
is a row of text.
The interactive interpreter displays a prompt
("
>>>
") that indicates the interpreter is ready to accept code. The user types a
line of Python code and presses the enter key to instruct the interpreter to execute the code. Initially you may think of the
interactive interpreter as a powerful calculator. The example program below calculates a salary based on a given hourly
wage, the number of hours worked per week, and the number of weeks per year. The speci±cs of the code are described
elsewhere in the chapter.
PARTICIPATION
ACTIVITY
1.2.1: The Python interpreter.
PARTICIPATION
ACTIVITY
1.2.2: Match the Python terms with their de±nitions.
If unable to drag and drop, refresh the page.
A program that executes computer
code.
The text that represents a computer
program.
Informs the programmer that the
interpreter is ready to accept
commands.
A row of text.
Executing a Python program
The Python interactive interpreter is useful for simple operations or programs consisting of only a few lines. However,
entering code line-by-line into the interpreter quickly becomes unwieldy for any program spanning more than a few lines.
Instead, a programmer can write Python code in a ±le, and then provide that ±le to the interpreter. The interpreter begins
by executing the ±rst line of code at the top of the ±le, and continues until the end is reached.
A statement
is a program instruction. A program mostly consists of a series of statements, and each statement
usually appears on its own line.
Expressions
are code that return a value when evaluated; for example, the code wage * hours * weeks
is an
expression that computes a number. The symbol *
is used for multiplication. The names wage, hours, weeks, and
salary are variables
, which are named references to values stored by the interpreter.
A new variable is created by performing an assignment
using the = symbol, such as
salary = wage * hours * weeks
, which creates a new variable called salary.
The print()
function displays variables or expression values.
'#' characters denote comments
, which are optional but can be used to explain portions of code to a human reader.
Many code editors color certain words, as in the below program, to assist a human reader in understanding various
words' roles.
PARTICIPATION
ACTIVITY
1.2.3: Executing a simple Python program.
Python interpreter
Name
Value
>>>
wage = 20
wage
20
>>>
hours = 40
>>>
weeks = 50
weeks
50
|
>>>
salary = wage * hours * weeks
>>>
print(salary)
40000
>>>
hours = 35
hours
35
>>>
salary = wage * hours * weeks
35000
salary
>>>
print(salary)
35000
>>>
1. After each press of the enter key, the python interpreter executes the line of code.
2. The python interpreter can be used as a calculator and can perform a variety of calculations.
3. Users can change values and execute calculations again.
Captions
Feedback?
Line
Prompt
Interpreter
Code
Reset
Feedback?
Start
2x speed
Start
2x speed
Activity summary for assignment: 1-3 zyBooks Participation Activities
98 %
98 % submitted to desire2learn
PARTICIPATION
ACTIVITY
1.2.4: Python basics.
1)
What is the purpose of variables?
Store values for later use.
Instruct the processor to execute
an action.
Automatically color text in the
editor.
2)
The code 20 * 40 is an expression.
True
False
3)
How are most Python programs
developed?
Writing code in the interactive
interpreter.
Writing code in ±les.
4)
Comments are required in a program.
True
False
zyDE 1.2.1: A ±rst program.
The below program simulates a race between two cars, displaying the position of each car at
the end of the race. Make sure the output box below the code is visible, then click "run."
The car1_top_speed and car1_acceleration variables control the maximum velocity and
acceleration of car 1. Modify these variables, and run the program again. Can you make the
second car win?
You do not need to understand how the code works right now. Instead, just modify the speed
and acceleration variables and observe how the output changes.
How was this
section?
|
wage = 20
hours = 40
weeks = 50
salary = wage * hours * weeks
print
(
'Salary is:'
, salary
)
hours = 35
salary = wage * hours * weeks
print
(
'New salary is:'
, salary
)
file.py
Python interpreter
>>>
Name
Value
wage
20
weeks
50
salary
40000
Salary is: hours
35
35000
35000
New salary is:
1. The python interpreter reads a ±le line by line. Variables wage, hours, and weeks are named
references that refer to values stored by the interpreter.
2. 20 * 40 * 50 is computed, and then assigned to the variable salary.
3. The print statement prints 'Salary is:' to the screen and displays the value of the variable
salary.
4. Values can be overwritten if the same variable name is used.
Captions
Feedback?
Feedback?
Load default template...
# Welcome to the Python 500 race! Click the run button to begin.
# Configurable values.
# Try changing car speeds, accelerations, and the simulation speed.
car1_top_speed = 60
car2_top_speed = 50
car1_acceleration = 11
car2_acceleration = 10
car1 = [
' ______\n'
,
' |__1_|_\\\n'
,
' O----O\n'
]
car2 = [
' ___\n'
,
' /__2_\\__\n'
,
' O----O\n'
]
Run
Feedback?
Provide section feedback
Completion details
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Quizzes
Grades
2. Area of a Circle
Computer programs are great at computing mathematical formulas. Once the formula is properly encoded you can use the code as much as you want without reprogramming it and you
can share it with non-programmers without any trouble. This lab is an example of such a formula. Once you program it you won't have to worry about the area of a circle again.
Syllabus
Zoom
• Write and test a program that computes the area ofa circle. This program should request a number representing a radius as input from the user.
• Use the formula 3.14 x radius to compute the area.
• Tip: There are a couple of ways to code an exponent. Look in the Operators unit for help (and you can't use an x for multiplication).
• Tip: You will need to use the float data type to compute the remainder.
- The output should explain the results. Don't just print a number.
• Tip: For your print statement you will need to use the comma, or plus, +symbols to stitch your output together.
- (The area…
arrow_forward
object oriented programming (OOP)
write a program that store the 10 numbers and then calculate the sum , average and multiplication of all numbers
arrow_forward
PYTHON PROGRAMMING
Chess Moves Mapper using Shortest path algorithm
As the title indicates, you will need to determine the number of moves it will take for the different chess pieces from their current position to any other tile in the board. While a standard chess board will have an 8 x 8 grid chess board, your code should be able to handle boards of different dimensions.
For this program the board will be blank. The only piece will be the one inputted.
Input Format
s1, s2, x1, y1, piece
All inputs end with a '\n'
s1, s2 - horizontal size and vertical size of the board respectively.
x1, y1 - starting position of the piece. Refer to Figure 3. for coordinate convention
piece - name of the piece. Use the following names. [pawn, rook, knight, bishop, queen, king]
Given the initial starting position of a given piece, you will be asked to determine the minimum number of moves needed to reach any position in the tile. A sample setup is shown below as well as a visualization of the…
arrow_forward
Skydiving
Bibi is a skydiving instructor. Before carrying out skydiving
activities, Bibi will always ask the name, height, and age
of the participants. Bibi's participants is always 2 people.
To make it easier to remember their identities, Bibi gave
them a paper to write down their identity. But because
they are very enthusiastic in doing skydiving, they write
their identity in a single line only (for both of the
participants), so it wasn't quite neat and it made difficult
for Bibi to see it, and resulted in the skydiving process
being disturbed. As one of the organizer committee, you
do not want this activity to be disturbed and plan to
provide a program that provides their identity neatly to
Bibi.
Format Input
Input consists of 1 line. It contains the identity of 2 people
in a row Ni, Ti, Ui - the name, height, and age of the i-th
participant.
Format Output
The output consists of 6 lines. The first line, "Name 1: N1".
The second line, "Height 1: T1". The third line, "Age: U1".
For…
arrow_forward
LABView
Draw by hand the diagram for a program that displays a count that increments 4 times per seconduntil the user pushes a stop button. Turn on a boolean light when the count is even. Thecount starts at 0 and goes until the user pushes the stop button.
arrow_forward
grok
Introduction to Programming (Python)
academy
8 - Looping and lists
Yuor biran is an azamnig thnig
Instructions Tutoring
O Problem
pi
Image source
na
Two words are anagrams of each other if they contain the same letters in them. So
na
left is an anagram of felt and vice-versa. A Super Anagram is a special kind of
So
anagram. A Super Anagram is an anagram whose first and last letters are the same.
So
if
Your program needs to read in two words on a single line. If the pair of words are Super
Anagrams of each other, print out Super Anagram!. If the pair of words is not a Super
Anagram (so a human couldn't read it), then print out Huh?. For one-letter words, the
first letter is the last letter.
So, for example:
Enter words: brain brian
Super Anagram!
and another example:
Enter words: too two
Huh?
arrow_forward
OpenGL programming help using c++
The program should generate the square. The square should move in response to the left mouse button being held down and the mouse moved. The figure should stop at the defined window boundaries (N,S,E,W) making sure that the entire figure is always present in your window.
arrow_forward
Course Level Programming Assignment - Programming a Calculator using Python
In this assignment you will write a computer program from scratch using the Python programming language. This program will function as a simple calculator.
Objectives
Write a simple Python program that performs arithmetic operations based on the user input
Stage 1: A simple calculator
Your calculator should provide the following arithmetic and control operations.
Arithmetic Operations
Addition (+) add(a,b)
Subtraction (-) subtract(a,b)
Multiplication (*) multiply(a,b)
Division (/) divide(a,b)
Power (^) power(a,b)
Remainder (%) remainder(a,b)
Control Operations
Terminate (#)
Reset ($)
Write a function select_op(choice) to select the appropriate mathematics function based on the users selection.
The behavior of the program should be as follows:
The program should ask the user to specify the desired operation…
arrow_forward
Many design strategies are used to make the code more readable.
arrow_forward
Slot Machine Simulation-
I need to get answer in Pseudocode
A slot machine is a gambling device that the user inserts money into and then pulls a lever (or presses a button). The slot machine then displays a set of random images. If two or more of the images match, the user wins an amount of money, which the slot machine dispenses back to the user.
Design a program that simulates a slot machine. When the program runs, it should do the following:
Ask the user to enter the amount of money he or she wants to insert into the slot machine.
Instead of displaying images, the program will randomly select a word from the following list:
Cherries, Oranges, Plums, Bells, Melons, Bars
The program will select and display a word from this list three times.
If none of the randomly selected words match, the program will inform the user that he or she has won $0. If two of the words match, the program will inform the user that he or she has won two times the amount entered. If three of the words…
arrow_forward
Computer Science
Using visual studio 2019 with a C# program create a WCF service to compute the distance between two points.
Let the user enter his or her first point and the second point.
arrow_forward
ID: A
Name:
ID: A
6. There are 32 students standing in a classroom. Two different algorithms are given for finding the average
height of the students.
Algorithm A
Step 1: All students stand.
gniwolldi odT
gaihnel vd
Step 2: A randomly selected student writes his or her height on a card and is seated.
Step 3: A randomly selected standing student adds his or her height to the value on the card, records the new
value on the card, and is seated. The previous value on the card is erased.
Step 4: Repeat step 3 until no students remain standing.
Step 5: The sum on the card is divided by 32. The result is given to the teacher.
Algorithm B
Step 1: All students stand.
Step 2: Each student is given a card. Each student writes his or her height on the card.
Step 3: Standing students form random pairs at the same time. Each pair adds the numbers written on their
cards and writes the result on one student's card; the other student is seated. The previous value on the card is
erased.
Step 4: Repeat…
arrow_forward
Instructions
A common problem in textual analysis is to determine the frequency and location of words in a document. The information is stored in a concordance, which lists the distinct words in alphabetical order and makes references to each line on which the word is used. For instance, consider the quotation:
Peter Piper picked a peck of pickled peppers. A peck of pickled peppers Peter Piper picked. If Peter Piper picked a peck of pickled peppers, where is the peck that Peter Piper picked?
The word "piper" occurs 4 times in the text and appears on lines 1, 2, and 3. The word "pickled" occurs 3 times and appears on lines 1 and 2.
For the text above, the output of the concordance is:
Word Frequency Occurs on lines:------------------------------------------------------------------a 3 1, 2if 1 2is 1…
arrow_forward
Instructions
A common problem in textual analysis is to determine the frequency and location of words in a document. The information is stored in a concordance, which lists the distinct words in alphabetical order and makes references to each line on which the word is used. For instance, consider the quotation:
Peter Piper picked a peck of pickled peppers. A peck of pickled
peppers Peter Piper picked. If Peter Piper picked a peck of
pickled peppers, where is the peck that Peter Piper picked?
The word “piper” occurs 4 times in the text and appears on lines 1, 2, and 3. The word “pickled” occurs 3 times and appears on lines 1 and 2.
For the text above, the output of the concordance is:
Write a c++ program to create a concordance for a text file. Since during the process of building the concordance, it is frequently necessary to look up the word in the current words in the concordance, update concordance entries, as well as insert new words into the concordance, a binary…
arrow_forward
True or False
Pseudo codes are set of rules on how statements can be conveyed.
Rectangle is a flow chart diagram which visually presents the flow of data through processing system.
The process of creating executable program through code written using a compiled programming language is called execution.
arrow_forward
Slove this using Midpoint line algorithm
computer graphics subject
int X1 = 2, Y1 = 2, X2 = 8, Y2 = 5;
Find the points between the start and the end point
arrow_forward
Python Algorithms
Part 1 – Binary SearchLet's play a little game to give you an idea of how different algorithms for the same problem can have wildly different efficiencies. If I choose an integer from 1 to 16 and ask you to guess what the number is, you can keep guessing numbers until you hit on it. When you guess wrong, I tell you whether you are too high or too low. Once you've guessed the number, think about the technique you used to decide each of your next guesses.If you guessed 1, then 2, then 3, then 4, and so on, until you guessed the right number, you used an approach called “linear search,” meaning you guessed the numbers serially and sequentially, as if they were lined up in a row. This is definitely one way to find the mystery number, but it could require as many as 16 guesses. However, you could get lucky, if the number was 1, you’d only need 1 guess. Using a linear search process, on average, you'd need 8 guesses.There is an approach that is more efficient than just…
arrow_forward
PYTHON PROGRAMMING ASSIGNMENT
PYTHON PROGRAMMING LANGUAGE ASSIGNMENT
Create a new text document called names.txt (this is done by hand - not using programming) with the following names: Adam, Bryan, Charlie. Each name should be followed by a hard return (do not store them in a list).
Main Function. Write a program where the user enters a name. Using the read function, check to see if the name is in the text document. If it is, respond back to the user the name is found within the list.
Read Function. The read function should return the contents of the text document as a list.
Write Function. The write function should take the list and override the file with the new names list in reverse alphabetical order with a hard return after each name.
arrow_forward
OpenGL programming (c++)
The program should generate a triangle that should move in response to the left mouse button being held down and the mouse moved. The figure should stop at the defined window boundaries (N,S,E,W) making sure that the entire figure is always present in your window.
arrow_forward
An
is a step-by-step procedure for finding the solution to a problem.
arrow_forward
Python Turtle Graphics
Draw a spiral diagram using Python turtle package program follows 3 steps:
Import the turtle module
Create a turtle to control.
Draw around using the turtle methods.
You should consider the following points in your solution:
The shapes should be drawn with the shown colors
Yellow and white for the square-like shapes.
Blue for the background.
The prompt should have a turtle shape.
The number of iterations should be 300
You should use only one loop.
The number of the yellow color lines should be 200.
The final shape of the output should be as shown in the picture attached.
Make sure to set properly the starting position (x & y) of your drawing, to maintain the required diagram.
video on youtube:
https://www.youtube.com/watch?v=ZqoJD2RMu1I
arrow_forward
PYTHON:
tell the user that if he/she has less than 4 tasks on the to-do list she has time to do more
tell the user that if he/she has more or equal than 6 items she has no room to do more tasks
arrow_forward
ne:
ID: A
7. A game is played by moving a game piece left or right along a horizontal game board. The board consists of
spaces of various colors, as shown. The circle represents the initial location of the game piece.
Yellow
Black
Green
Green
Red
Yellow
Yellow
Black
Black
Black
The following algorithm indicates how the game is played. The game continues until the game is either won
by landing on the red space or lost when the piece moves off either end of the board.
Step 1: Place a game piece on a space that is not red and set a counter to 0.
Step 2: If the game piece is on a yellow space, move the game piece 3 positions to the left and go to step 3.
Otherwise, if the game piece is on a black space, move the game piece 1 position to the left and go to step 3.
Otherwise, if the game piece is on a green space, move the game piece 2 positions to the right and go to step
3.
Step 3: Increase the value of the counter by 1.
Step 4: If game piece is on the red space or moved off the end of the…
arrow_forward
message-passing (MPI) libraries
Triangular number Series: A triangle number counts the objects that can form an equilateral triangle. The nth triangle number is the number of dots or balls in a triangle with n dots on a side; it is the sum of the n natural numbers from 1 to n. • The formula for the nth triangular number can be expressed as: ?? = ∑ ? ? ?=1 = 1 + 2 + 3 + ⋯ + ? = ?(? + 1) 2 = ( ? + 1 2 ) • The first few triangular numbers are: 0, 1, 3, 6, 10, 15, …… • Pictorially, the triangular numbers can be represented as below: Write a program that generates the triangular number series from the first term up until the n th term. In your program, the user will enter the n number, choose a large number! The sequence should be printed in the correct order. Regarding the number of threads/processes, try at least three different numbers (e.g., 2, 4, 8).
arrow_forward
Compare Numbers - Python Language please!
Programming challenge description:
Little Tommy is in kindergarten on the first day of class. His teacher has taught him about inequalities today, and he is learning how to draw crocodiles to represent them. When there are two numbers, A and B, there are three options:1. If A is greater than B, then draw '>'. The crocodile's mouth is pointed toward the bigger number, A.2. If A is less than B, then draw '<'. The crocodile faces B.3. If A is equal to B, draw '='. The crocodile is confused and keeps its mouth shut.Unfortunately, Tommy does not like to do his homework, and has bribed you to write a program to do it for him.
Input:
The input consists of two integers A and B on a line, separated by a space. |A,B| < 2^63.
Output:
Print a line containing the appropriate symbol that describes the relationship between the numbers.
Test 1
Test InputDownload Test 1 Input
35 40
Expected OutputDownload Test 1 Output
<
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Related Questions
- Quizzes Grades 2. Area of a Circle Computer programs are great at computing mathematical formulas. Once the formula is properly encoded you can use the code as much as you want without reprogramming it and you can share it with non-programmers without any trouble. This lab is an example of such a formula. Once you program it you won't have to worry about the area of a circle again. Syllabus Zoom • Write and test a program that computes the area ofa circle. This program should request a number representing a radius as input from the user. • Use the formula 3.14 x radius to compute the area. • Tip: There are a couple of ways to code an exponent. Look in the Operators unit for help (and you can't use an x for multiplication). • Tip: You will need to use the float data type to compute the remainder. - The output should explain the results. Don't just print a number. • Tip: For your print statement you will need to use the comma, or plus, +symbols to stitch your output together. - (The area…arrow_forwardobject oriented programming (OOP) write a program that store the 10 numbers and then calculate the sum , average and multiplication of all numbersarrow_forwardPYTHON PROGRAMMING Chess Moves Mapper using Shortest path algorithm As the title indicates, you will need to determine the number of moves it will take for the different chess pieces from their current position to any other tile in the board. While a standard chess board will have an 8 x 8 grid chess board, your code should be able to handle boards of different dimensions. For this program the board will be blank. The only piece will be the one inputted. Input Format s1, s2, x1, y1, piece All inputs end with a '\n' s1, s2 - horizontal size and vertical size of the board respectively. x1, y1 - starting position of the piece. Refer to Figure 3. for coordinate convention piece - name of the piece. Use the following names. [pawn, rook, knight, bishop, queen, king] Given the initial starting position of a given piece, you will be asked to determine the minimum number of moves needed to reach any position in the tile. A sample setup is shown below as well as a visualization of the…arrow_forward
- Skydiving Bibi is a skydiving instructor. Before carrying out skydiving activities, Bibi will always ask the name, height, and age of the participants. Bibi's participants is always 2 people. To make it easier to remember their identities, Bibi gave them a paper to write down their identity. But because they are very enthusiastic in doing skydiving, they write their identity in a single line only (for both of the participants), so it wasn't quite neat and it made difficult for Bibi to see it, and resulted in the skydiving process being disturbed. As one of the organizer committee, you do not want this activity to be disturbed and plan to provide a program that provides their identity neatly to Bibi. Format Input Input consists of 1 line. It contains the identity of 2 people in a row Ni, Ti, Ui - the name, height, and age of the i-th participant. Format Output The output consists of 6 lines. The first line, "Name 1: N1". The second line, "Height 1: T1". The third line, "Age: U1". For…arrow_forwardLABView Draw by hand the diagram for a program that displays a count that increments 4 times per seconduntil the user pushes a stop button. Turn on a boolean light when the count is even. Thecount starts at 0 and goes until the user pushes the stop button.arrow_forwardgrok Introduction to Programming (Python) academy 8 - Looping and lists Yuor biran is an azamnig thnig Instructions Tutoring O Problem pi Image source na Two words are anagrams of each other if they contain the same letters in them. So na left is an anagram of felt and vice-versa. A Super Anagram is a special kind of So anagram. A Super Anagram is an anagram whose first and last letters are the same. So if Your program needs to read in two words on a single line. If the pair of words are Super Anagrams of each other, print out Super Anagram!. If the pair of words is not a Super Anagram (so a human couldn't read it), then print out Huh?. For one-letter words, the first letter is the last letter. So, for example: Enter words: brain brian Super Anagram! and another example: Enter words: too two Huh?arrow_forward
- OpenGL programming help using c++ The program should generate the square. The square should move in response to the left mouse button being held down and the mouse moved. The figure should stop at the defined window boundaries (N,S,E,W) making sure that the entire figure is always present in your window.arrow_forwardCourse Level Programming Assignment - Programming a Calculator using Python In this assignment you will write a computer program from scratch using the Python programming language. This program will function as a simple calculator. Objectives Write a simple Python program that performs arithmetic operations based on the user input Stage 1: A simple calculator Your calculator should provide the following arithmetic and control operations. Arithmetic Operations Addition (+) add(a,b) Subtraction (-) subtract(a,b) Multiplication (*) multiply(a,b) Division (/) divide(a,b) Power (^) power(a,b) Remainder (%) remainder(a,b) Control Operations Terminate (#) Reset ($) Write a function select_op(choice) to select the appropriate mathematics function based on the users selection. The behavior of the program should be as follows: The program should ask the user to specify the desired operation…arrow_forwardMany design strategies are used to make the code more readable.arrow_forward
- Slot Machine Simulation- I need to get answer in Pseudocode A slot machine is a gambling device that the user inserts money into and then pulls a lever (or presses a button). The slot machine then displays a set of random images. If two or more of the images match, the user wins an amount of money, which the slot machine dispenses back to the user. Design a program that simulates a slot machine. When the program runs, it should do the following: Ask the user to enter the amount of money he or she wants to insert into the slot machine. Instead of displaying images, the program will randomly select a word from the following list: Cherries, Oranges, Plums, Bells, Melons, Bars The program will select and display a word from this list three times. If none of the randomly selected words match, the program will inform the user that he or she has won $0. If two of the words match, the program will inform the user that he or she has won two times the amount entered. If three of the words…arrow_forwardComputer Science Using visual studio 2019 with a C# program create a WCF service to compute the distance between two points. Let the user enter his or her first point and the second point.arrow_forwardID: A Name: ID: A 6. There are 32 students standing in a classroom. Two different algorithms are given for finding the average height of the students. Algorithm A Step 1: All students stand. gniwolldi odT gaihnel vd Step 2: A randomly selected student writes his or her height on a card and is seated. Step 3: A randomly selected standing student adds his or her height to the value on the card, records the new value on the card, and is seated. The previous value on the card is erased. Step 4: Repeat step 3 until no students remain standing. Step 5: The sum on the card is divided by 32. The result is given to the teacher. Algorithm B Step 1: All students stand. Step 2: Each student is given a card. Each student writes his or her height on the card. Step 3: Standing students form random pairs at the same time. Each pair adds the numbers written on their cards and writes the result on one student's card; the other student is seated. The previous value on the card is erased. Step 4: Repeat…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning