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
How to construct a 112.5 degree angle?
worty [1.4K]
You can construct it with a protractor. 
7 0
3 years ago
Sean has trouble remembering all the geometry formulas. What can he do to make sure he doesn't forget these formulas during his
son4ous [18]
3 i think but im not sure
7 0
3 years ago
Read 2 more answers
Which logical operators perform short-circuit evaluation?.
Sergio039 [100]

Answer:

Short-circuit evaluation is performed with the not operator.

8 0
2 years ago
William would like to sort a list of items after the data is already entered.
kari74 [83]

Answer:

Database software

Explanation:

6 0
3 years ago
PLEASE TELL ME WHAT THIS MEANS<br><br> dir="rtl"&gt;יזבל
Ipatiy [6.2K]
Check other question
7 0
3 years ago
Other questions:
  • What is a mortgage?
    8·2 answers
  • In 1970, the federal government created __________ to both assist and require employers and employees to make the prevention of
    14·1 answer
  • The objective of ____ testing is to identify and eliminate execution errors that could cause a program to terminate abnormally,
    15·1 answer
  • What is internet marketing??
    13·1 answer
  • • Microsoft Windows 7 Operating System • 7-Zip • Adobe Acrobat Professional • Adobe Reader • Google Chrome • Microsoft Internet
    8·1 answer
  • 4.8 code practice question 2 edhesive
    12·1 answer
  • Tyra is peer conferencing about her project with a friend. Tyra's friend provided feedback that Tyra does not agree with. What s
    6·1 answer
  • Which of the following techniques is a direct benefit of using Design Patterns? Please choose all that apply Design patterns hel
    12·1 answer
  • What would give Lucy, an entry-level candidate, an edge over others while she seeks a programmer’s position? Lucy, an entry-leve
    11·1 answer
  • A statement that starts with a # symbol is called
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!