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
forsale [732]
3 years ago
6

In Python, what is returned when evaluating [n for n in range(10) if n % 2]?​

Computers and Technology
1 answer:
Firlakuza [10]3 years ago
8 0
First we need to understand what "n for n in range(10)" means. Basically, we are iterating through all the values n that are in the range of 10 (meaning 0, 1, 2, 3, ..., 9).

Next we are evaluating if n%2. The percentage sign is used to represent modulus which is the remainder of when two numbers are divided. In this case, we are dividing n by 2, and the remainder is our result. When dividing by 2, the only possible remainders are 0 or 1, which when used in an if statement represent the boolean vlaues false and true, respectively. We are doing this calculation for each n from 0 to 9, and if the result is true, we output n to an array.

The numbers that will result in true (a remainder of 1) are the odds numbers. For example, 4/2 = 2 with nothing left over while 5/2 = 2 with 1 left over.

So the following is returned:

[1, 3, 5, 7, 9]
You might be interested in
Smileys Pizzeria has a special on cheese pizza this month. 6- inch personal pizzas are $5, 10-inch small pizzas are $8, 14-inch
ValentinkaMS [17]

Answer:

THE PROGRAM IS ANEW ONE IT IS CALLED SMILEYS CHOOSER

Explanation:

4 0
3 years ago
PLEASE HELP
lesantik [10]

Answer:

follow me pls tank you

Explanation:

im very happy if you follow me

3 0
3 years ago
Computer models are the only type of model that can be used to make predictions. Please select the best answer from the choices
katrin2010 [14]
<span>Computer models are the only type of model that can be used to make predictions.
This is a false statement.

</span>
8 0
3 years ago
Read 2 more answers
Which studio produced the film the jazz singer the first of many talkies
sasho [114]
What is a talkie ? please tell me
7 0
3 years ago
What are the best data structures to create the following items? And why?
Airida [17]

Answer:

The best structures to create the following items are

  1. ARRAY
  2. HASHMAPS
  3.  QUEUE
  4. SORTED LINK LISTS

Explanation:

The best structures to create the following items are:

  1. Array : for the storage of cards in a card game the best data structure to be used should be the Array data structure. this is because  the size of the data ( 52 cards ) is known and using Array will help with the storing of the cards values in the Game.
  2. Hashmaps : Hashmap data structure should be implemented in online shopping cart this IS BECAUSE  items can be easily added or removed from the cart therefore there is a need to map the Items ID or name to its actual database
  3. online waiting list are usually organised/arranged in a first-in-first-out order and this organization is best created using the queue data structure
  4. Sorted link lists is the best data structure used to create, store and manage online tickets. the sorted link data structure helps to manage insertions and deletions of tickets in large numbers  and it also reduces the stress involved in searching through a large number of tickets by keeping the tickets in sorted lists
3 0
3 years ago
Other questions:
  • Suppose that cells B1 through B100 of an Excel spreadsheet contain the quantity of units ordered on each of 100 different days.
    13·1 answer
  • PL Technologies suffered considerable data loss when its database was infected by a virus. George, an operations personnel, atte
    8·1 answer
  • What was the name of the system developed by Frederick Winslow Taylor, in which mass production is tied to the cultivation of ma
    10·1 answer
  • During the Requirements Definition stage of a systems development​ project, the employees who will be the primary users of the n
    15·1 answer
  • Which description best describes how mass spectroscopy is useful in the field of forensic toxicology
    6·1 answer
  • I'm a number less then 40000.all my digits are multiples of 3.my first third a d fifth digits are the same both of my thousands
    10·1 answer
  • After reading the article, "The Impact of Technology", answer the following question.
    14·1 answer
  • Define the missing method. use "this" to distinguish the local member from the parameter name.
    11·2 answers
  • 3 Points
    15·2 answers
  • Which statement describes Augmented Reality (AR) technology?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!