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
OlgaM077 [116]
2 years ago
11

Provide your own examples of the following using Python lists. Create your own examples. Do not copy them from another source. N

ested lists The “*” operator List slices The “+=” operator A list filter A list operation that is legal but does the "wrong" thing, not what the programmer expects Provide the Python code and output for your program and all your examples.
Computers and Technology
1 answer:
leonid [27]2 years ago
6 0

Lists are used in Python to hold multiple values in one variable

<u>(a) Nested list</u>

A nested list is simply a list of list; i.e. a list that contains another list.

It is also called a 2 dimensional list.

An example is:

nested_list = [[ 1, 2, 3, 4]  , [ 5, 6, 7]]

<u>(b) The “*” operator </u>

The "*" operator is used to calculate the product of numerical values.

An example is:

num1 = num2 * num3

<u>List slices </u>

This is used to get some parts of a list; it is done using the ":" sign

Take for instance, you want to get the elements from the 3rd to the 5th index of a list

An example is:

firstList = [1, 2 ,3, 4, 5, 6, 7]

secondList = firstList[2:5]

<u>The “+=” operator </u>

This is used to add and assign values to variables

An example is:

num1 = 5

num2 = 3

num2 += num1

<u>A list filter </u>

This is used to return some elements of a list based on certain condition called filter.

An example that prints the even elements of a list is:

firstList = [1, 2 ,3, 4, 5, 6, 7]

print(list(filter(lambda x: x % 2 == 0, firstList)))

<u>A valid but wrong list operation</u>

The following operation is to return a single list, but instead it returns as many lists as possible

def oneList(x, myList=[]):

   myList.append(x)

   print(myList)

oneList(3)

oneList(4)

Read more about Python lists at:

brainly.com/question/16397886

You might be interested in
Which principle or element of layout design is highlighted in this event poster?
Oduvanchick [21]

The  principle or element of layout design is highlighted in an event poster in option i: The headline.

<h3>What are the elements of page layout?</h3>

The poster is known to be one that often uses a kind of hierarchy and centered text alignment as its element.

Note that it is one whose Lines of use is said to be made up of different kinds of type styles, sizes and others.

The simple elements of an advertising poster is made up of:

1. The headline.

2. The sub-head.

3. The body copy.

4. The caption.

The elements of page layout are visual hierarchy, visual flow, and others. Hence, the  principle or element of layout design is highlighted in an event poster in option i: The headline.

Learn more about layout design from

brainly.com/question/2501083

#SPJ1

6 0
2 years ago
The ____ is the period of time within which systems, applications, or functions must be recovered after an outage. Select one:
scZoUnD [109]

Answer:

c. recovery time objective                                                  

Explanation:

  • Recovery time objective (RTO) is the maximum acceptable duration permitted between an unfortunate loss or failure and the restoration of normal operations and services.
  • According to the RTO, the systems, applications or operations must be restored within a targeted time period after a disaster, to avoid unacceptable outcomes of the disruption.
  • So a business process must be recovered within this period of time.
  • It measures how much a failure affects the normal operations, applications and systems and RTO is measures in time units like seconds minutes hours or days.
  • In simple words RTO refers to the time you need to restore system, applications and data.
  • For instance a 2-hour RTO refers to restore and get operations or services back to running within 2 hours of the service failure or outrage.
6 0
3 years ago
The use of technological advances in agriculture to increase harvests
BigorU [14]
Tractors,water works, plows, water in general
3 0
3 years ago
A network that has locations in different countries is considered a WAN.<br> a. Trueb. False
fiasKO [112]

Answer:

True.

Explanation:

Wide area network (WAN) can be defined as a telecommunication network that covers a wide range of geographical locations such as countries or regions across the world for the purpose of communication and sharing information and data between different users.

Hence, a network that has locations in different countries is considered a wide area network (WAN).

Generally, wide area network (WAN) makes it possible for various organizations to interconnect with their branch offices, headquarters and other multiple locations across the globe. Wide area network (WAN) usually span over a distance of 50 kilometers.

6 0
3 years ago
Lots of data can be transferred in short time, when we have,
dusya [7]

Answer: B. Higher Bandwidth

8 0
2 years ago
Read 2 more answers
Other questions:
  • Given that Jamie worked 50 hours (Hours = 50) last week and earns $10.00 an hour (Rate = 10), how much did Jamie earn last week,
    11·1 answer
  • In a(n) __________ situation, a wireless device is configured to appear to be a legitimate access point, enabling the operator t
    14·1 answer
  • Assume you have taken another square picture with the 25-megapixel digital camera discussed in the previous question. This time
    8·1 answer
  • What is ‘validation’?
    5·1 answer
  • COMPUTER SCIENCE:PIXELS
    5·1 answer
  • Guess The Song: <br> What Popping Brand New Whip Just Hopped In, I Got options
    15·1 answer
  • Keira is creating an app for her cross-country team. Users will input their race times and the output will be a graph showing th
    6·1 answer
  • In java I need help on this specific code for this lab.
    5·1 answer
  • Does anyone know how many Brainliests you need to be able to send a private message to someone??
    10·2 answers
  • WILL GIVE BRAILIEST
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!