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
Which of the following can you NOT apply for at any FLHSMV office? A. Certificate of title B. License plates C. Vehicle registra
tia_tia [17]

Answer:A

Explanation:

8 0
3 years ago
Read 2 more answers
. Describe a way to simplify a complex problem.
Inga [223]

Answer:

Simplify a complex problem means reduces its complexity and make it easy to understand. When we make the problem simplified then, the data become more clear and understandable.

There are many ways to simplify a complex problem as follows:

  • Organize the information and content properly and reduces the layers of complexity. Organized the content in the form of steps so that it become easy to understand.
  • Use of clear language is one of the most important part to make the content more clear and use proper formatting of the data.
  • Break the information into smaller parts to it can easy to read and looks more clearly. So, the reader finds it more comfortable and efficient.

5 0
3 years ago
Que significa el término Informática?
AleksandrR [38]

La informática es el estudio de la estructura, el comportamiento y las interacciones de los sistemas computacionales naturales y diseñados. La informática estudia la representación, el procesamiento y la comunicación de información en sistemas naturales y de ingeniería

6 0
3 years ago
A __________ is typically stored in a JAR file and contains one or more packages that you want to make available to other projec
dsp73

Answer:

<u>class -files and auxiliary resources</u>

Explanation:

JAR stands for Java Archive which allows one to make multiple file bundles into a single file which is archive file and these JAR files contains in them the the auxiliary resources and the class files.

The archive file allows us to be storage efficient by compressing our data and files.

These files also allows us to transform our software into extensions as well.

For the enforcement of consistency of version of the packages, these files can be sealed optionally.

6 0
3 years ago
Intro to cs 3.7 edhesive g=float(input("Enter your English test grade:")) if(g&lt;=64): print("F") if (g&gt;=65 and g&lt;69): pr
qwelly [4]

Answer:

The correct code for this question:

g=float(input("Enter your English test grade:")) #take input from user.

#check conditions

if (g>=100 and g<=90):

print ("A")

#g greater then equal to 100 and less then equal to 90.

if (g>=89 and g<=80):

print("B")

#g greater then equal to 89 and less then equal to 80.

if (g>=79 and g<=70):

print("C")

#g greater then equal to 79 and less then equal to 70.

if (g>=69 and g<=65):

print("D")

#g greater then equal to 69 and less then equal to 69.

if(g<=64):

print("F")

#g less then equal to 64.

else:

print ("Not a grade")

#not a grade or fail.

Explanation:

In this program, we use to take a value from the user and check the value from the various conditions. To check all the condition we use if-else statement and AND operator that check to the range to together.

If -else is a conditional operator. In that, If block is used to check the true part and else part takes false value, and AND is a logical operator that check the two range together  

5 0
3 years ago
Other questions:
  • Semiconductor memory is used mainly for primary storage even with its high cost. In another hand, the magnetic tape is the cheap
    9·2 answers
  • The Circle of Growth
    10·1 answer
  • Why should the data in a reservation system that is constantly being updated be stored on a magnetic disk instead of a CD or DVD
    15·1 answer
  • You have been given the job of creating a new order processing system for the Yummy Fruit CompanyTM. The system reads pricing in
    8·1 answer
  • Which of the following tools enables a production mixer to sync audio and video?
    7·1 answer
  • Tennis players are not allowed to swear when they are playing in Wimbledon
    6·2 answers
  • Edhesive 9.3 code practice
    11·1 answer
  • The most widely used computer device​
    6·2 answers
  • A computer game allows a player to repeat a level until they run out of lives. Which two of the following loops would work corre
    8·2 answers
  • Organizations can face criminal or civil penalties for being ______ in protecting their sensitive data.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!