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
iVinArrow [24]
2 years ago
11

Write a program that uses a while loop to calculate and print the multiples of 3 from 3 to 21. Your program should print each nu

mber on a separate line. Expected Output:
3
6
9
12
15
18
21
Computers and Technology
1 answer:
nexus9112 [7]2 years ago
6 0

Code:

num = 3

while num <= 21:

   print(num)

   num+=3

Output of code:

3

6

9

12

15

18

21

Explanation:

The condition num <= 21 will ensure that the program will only print multiples of 3 up to 21. We set num as 3 since we want to start printing from 3, and we add 3 each time to get the multiples.

Hope this helps :)

You might be interested in
(4 points.) Write an algorithm (i.e., step-by-step instructions) via which someone could walk or drive from some origin to some
Elis [28]

Answer:

The algorithm is as follows :

1. Record Current Position, Final Destination

2. While Current Position is not Final Destination, repeat the following:

2.1 If destination location is up then:

  2.1.1 If an obstacle is directly above you then:

     2.1.1.1 Look for alternate position (left, right, down)

     2.1.1.2 If alternate position is found then

        2.1.1.2.1 Move there

        2.1.1.2.2 Record Current Position

     2.1.1.3 If no alternate position is found then

        2.1.1.3.1 Call for help

        2.1.1.3.2 End

  2.1.2 If no obstacle is directly above you then:

     2.1.2.1 Move up

     2.1.2.1 Record Current Position

2.2 If destination location is down then:

  2.2.1 If an obstacle is directly below you then:

     2.2.1.1 Look for alternate position (left, right, up)

     2.2.1.2 If alternate position is found then

        2.1.1.2.1 Move there

        2.2.1.2.2 Record Current Position

     2.2.1.3 If no alternate position is found then

        2.2.1.3.1 Call for help

        2.2.1.3.2 End

  2.2.2 If no obstacle is directly below you then:

     2.2.2.1 Move down

     2.1.2.1 Record Current Position

2.3 If destination location is right then:

  2.3.1 If an obstacle is directly by your right then:

     2.3.1.1 Look for alternate position (down, up, left)

     2.3.1.2 If alternate position is found then

        2.3.1.2.1 Move there

        2.3.1.2.2 Record Current Position

     2.3.1.3 If no alternate position is found then

        2.3.1.3.1 Call for help

        2.3.1.3.2 End

  2.3.2 If no obstacle is directly by your right then:

     2.3.2.1 Move right

     2.3.2.1 Record Current Position

2.4 If destination location is left then:

  2.4.1 If an obstacle is directly by your left then:

     2.4.1.1 Look for alternate position (down, up, right)

     2.4.1.2 If alternate position is found then

        2.4.1.2.1 Move there

        2.4.1.2.2 Record Current Position

     2.4.1.3 If no alternate position is found then

        2.4.1.3.1 Call for help

        2.4.1.3.2 End

  2.4.2 If no obstacle is directly by your left then:

     2.4.2.1 Move left

     2.4.2.1 Record Current Position

Explanation:

<em>The algorithm is straight forward.</em>

<em>All it does is to check for available position and move into the position if there is any available.</em>

<em>It keeps checking and moving until an obstacle prevents it from moving.</em>

5 0
3 years ago
How do you run a function in python?
Black_prince [1.1K]
You can call a Python function like so: function(parameters).

Example:

Define function add:
def add(x,y):
return x+y

Call function:
add(3,7) -> 10
3 0
3 years ago
Why is OS important in every data processing system? <br>Please Answer Fast! ​
Artist 52 [7]

Answer:

Functions of an operating system. An operating system provides three essential capabilities: It offers a UI through a CLI or GUI; it launches and manages the application execution; and it identifies and exposes system hardware resources to those applications -- typically, through a standardized API.

Explanation:

6 0
2 years ago
4. What is the difference between portrait orientation and landscape orientation? (1.0 points)
Bezzdna [24]

Answer:

Portrait orientation is taller then it is wide, while landscape orientation is wider then it is tall.

Explanation:

3 0
3 years ago
Which number is the smallest? 4.4 ⋅ 10^-5, 3.99 ⋅ 10^-6, 2.6 ⋅ 10^3
tiny-mole [99]
3.99 • 10^3 is the smallest
8 0
2 years ago
Other questions:
  • The project started the development of inter-network connections using tcp/ip that has evolved into the internet today.
    5·1 answer
  • Please answer this correctly the underline drop down menu in the font group contains options to underline
    13·1 answer
  • _________ is critical to Amazon's success.<br><br> SCM<br><br> JIT<br><br> ERP<br><br> VMI
    9·1 answer
  • The loss of privacy data has implications:
    5·1 answer
  • What tool is provided in Windows to facilitate sharing data objects between applications and computers?
    8·1 answer
  • The sample remote access policy document from the hospital that you reviewed in the lab showed that the Remote Access Domain is
    15·2 answers
  • Witch of the following is a valid why a scientist might a scientific theory
    13·1 answer
  • Why the internet is not considered a mass medium in Africa​
    13·2 answers
  • Write a Java program that has a static method named range that takes an array of integers as a parameter and returns the range o
    10·1 answer
  • 9.2 lesson practice ​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!