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
WILL GIVEE BRAINLIEST ANSWER!!!!
Licemer1 [7]

Answer:

People have been ringing the death knell for email on and off for a few years now. But should we be listening?

The latest peal came from French IT company Atos, which declared that it would phase out internal emails by 2013. And for reasons we’ll all recongize: too much time spent dealing with too many emails, of which too few are useful and too many are spam. CEO Thierry Breton said his staff would instead use good old face-to-face communication, as well as instant messaging (IM) and social media tools.

3 0
3 years ago
Sam has created a fashion website. There are many subscribers to his website. He has added new blogs, pictures, and articles abo
marusya05 [52]

Answer:

Post advertisements on social media and message the subscribers.

Explanation:

There is no point in not promoting and putting forward the work that he has been doing. All of the given options are about promoting the content but Sam needs to choose the ones which are efficient and seem professional as well.

Posting advertisements about the website promotes the content on a wider base and helps in luring more and more people to the website.

Messaging or sending an email to the subscribers is a healthy of letting the subscribers about the updates and latest posts.

8 0
3 years ago
The term used to describe the shape and layout of a computer component such as a motherboard or hard drive is __ factor?
Flauer [41]
FORM factor. Example are ATX, micro ATX, and many more. ATX and MATX are the most common next to servers as well
3 0
3 years ago
You need to know the MAC address of a Windows 8 computer. How can you accomplish this?
Gre4nikov [31]

1.press window key + R

2.type cmd and press enter

3. write "ipconfig /all" without quotes and press enter

4. look for physical address word

that's your Mac address

6 0
3 years ago
Which of the following is a best practice regarding the Administrator account?
lara31 [8.8K]

Answer:

B. The account should be given a nondescript account name that cannot be easily guessed.

3 0
3 years ago
Other questions:
  • In the spreadsheet example shown in chapter 5 ____ run from top bottom and are designated by a letter?
    12·2 answers
  • A Narrative Statement illustrates how your life will look when you reach a goal.
    15·2 answers
  • ____ allows you to control how objects enter, move on and exit slides
    13·2 answers
  • You can combine the algorithms for converting between infix to postfix and for evaluating postfix to evaluate an infix expressio
    13·1 answer
  • 1. What are copyright laws? (6 points)
    15·1 answer
  • For this assignment, you will write a program that calculates gross and net revenue for a movie theater. Consider the following
    15·1 answer
  • Project stem test 3 answers
    14·1 answer
  • What kind of energy transformation occurs when you call someone on a cell phone?
    11·1 answer
  • Which network device sends data to every device that is connected to it?.
    7·1 answer
  • What is software engineering? What are the objectives of software engineering?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!