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
7nadin3 [17]
3 years ago
15

Write the code to produce a for loop that counts down from 20 to 0 by 2’s and prints the number each time it goes through the lo

op. (python)
Computers and Technology
1 answer:
yulyashka [42]3 years ago
3 0

Explanation:

Count-controlled for loop (Three-expression for loop)

This is by far the most common type. This statement is the one used by C. The header of this kind of for loop consists of a three-parameter loop control expression. Generally it has the form:

for (A; Z; I)

A is the initialisation part, Z determines a termination expression and I is the counting expression, where the loop variable is incremented or dcremented. An example of this kind of loop is the for-loop of the programming language C:

for (i=0; i <= n; i++)

This kind of for loop is not implemented in Python!

Numeric Ranges

This kind of for loop is a simplification of the previous kind. It's a counting or enumerating loop. Starting with a start value and counting up to an end value, like for i = 1 to 100

Python doesn't use this either.

Vectorized for loops

They behave as if all iterations are executed in parallel. This means, for example, that all expressions on the right side of assignment statements get evaluated before the assignments.

Iterator-based for loop

Finally, we come to the one used by Python. This kind of a for loop iterates over an enumeration of a set of items. It is usually characterized by the use of an implicit or explicit iterator. In each iteration step a loop variable is set to a value in a sequence or other data collection. This kind of for loop is known in most Unix and Linux shells and it is the one which is implemented in Python.

Example of a simple for loop in Python:

>>> languages = ["C", "C++", "Perl", "Python"]  

>>> for x in languages:

...     print(x)

...  

C

C++

Perl

Python

>>>

You might be interested in
Data with values that change continuously or smoothly over time is known as:
Alexeev081 [22]

Answer:

A.  \:  \boxed{analog  \: data}

5 0
3 years ago
Read 2 more answers
How can you find the square root of 8 using the pow() function
zimovet [89]

import math

print(math.pow(8, 0.5))

You can find the square root of any number by squaring it by 0.5

7 0
3 years ago
What do u do to me pepa
Maru [420]
Peppa: Hello Susie!

Susie: *mehhh* Hello Peppa!
What are you doing?
Peppa: I'm learning to whistle,

but I can't do it yet.
Susie: Hmm.. that sounds hard.
Peppa: It's impossible!
Uh.. can you whistle Susie?
Susie: No

Peppa: *honk* Oh good! I mean-
that's sad if you can't whistle

but good because I can't whistle

Susie: What's whistling anyway?
Peppa: You put your lips together
and blow!
Susie: Like this? *whistles*
8 0
3 years ago
Which of the following binary numbers is equivalent to decimal 4?
melomori [17]

Answer:

b so easy

Explanation:

5 0
3 years ago
Read 2 more answers
Which process refers to starting up a computer
lisabon 2012 [21]
The process is called booting
4 0
3 years ago
Read 2 more answers
Other questions:
  • URGENT!
    15·1 answer
  • 110101111.11011 to decimal (base 10)
    6·1 answer
  • python A pet shop wants to give a discount to its clients if they buy one or more pets. The discount is equal to 20 percent of t
    12·1 answer
  • There are 22 gloves in a drawer: 5 pairs of red gloves, 4 pairs of yellow, and 2 pairs of green. You select the gloves in the da
    12·1 answer
  • A location in memory used for storing data and given a name in a computer program is called a because the data in the location c
    14·1 answer
  • ___________________ are aggregated collections of memory and cpu resources that can be shared among groups of virtual machines o
    11·1 answer
  • How do I write a pseudocode algorithm to read a sequence of number terminated by the number 999 and print the sum of the positiv
    7·1 answer
  • In Subtractive empathy, the counselor responses gives back less (or distorts) than what the client has said. slightly add someth
    14·1 answer
  • Arrange the computers in the order fastest to slowest: Minicomputer, Supercomputer, Personal Computer and Mainframe.
    9·1 answer
  • when a stock or bond certificate is delivered, it must be in good transferable form. if the certificate is badly mutilated, it m
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!