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
zvonat [6]
3 years ago
13

Write Python expressions corresponding to these statements:

Computers and Technology
1 answer:
Luda [366]3 years ago
7 0

Answer:

The code with explanatory comments are given in Python below

Explanation:

#2.22

s = "Lionel Pogba"   #string s with names having LP as initials

names = s.split()  #splits the string into individual characters

initial = ""  #we are initialising the initials as an empty string

for i in names:

   initial += i[0]  #making the initials of the string

print(initial)

#2.23

l = [3, 7, -2, 12]  

range = (max(l) - min(l))  #declare and initialise variable range for the range

print(range) #output of the range

#2.24

l1 = [3, 7, 17, -2, 12]

#(a)

midIndex = int(len(l1)/2)  #evaluates half the length of the list

#which corresponds to the middle index of the list

print(midIndex)

#(b)

print(l1[midIndex])  #assigns the value of the middle index of the list

#corresponding to the middle element

#(c)

l1.sort(reverse=True) #reverses the elements of the list to descending order

print(l1)

#(d)

firstValue = l1[0]  #firstValue variable representing the first element

l1 = l1[1:] + [firstValue] #assigning the location to the last position

print(l1)

You might be interested in
When malicious code is planted on your computer and alters your browser's ability to find web addresses, it is known as ________
tresset_1 [31]
The answer is Phishing
3 0
4 years ago
Read 2 more answers
Blogs differ from most other online text sources because they
allochka39001 [22]
Tell you what a person's life is like
4 0
4 years ago
Read 2 more answers
The programming language that translates digital data into printer commands is known as
jolli1 [7]
The answer is C.) PostScript
8 0
3 years ago
Jennifer has written a business report. What should be her last step before she submits the story for publication?
Montano1993 [528]
Revising and editing because it makes the report look sharp and business like.
5 0
4 years ago
Read 2 more answers
When a user attempts to visit an internet-based web server, what is the default action of the windows firewall?
Kamila [148]
Google chrome and internet explore
7 0
3 years ago
Other questions:
  • What is the function of the modem?
    12·2 answers
  • Which one of the following is a functional requirement? Select one: a. None of the mentioned b. Robustness c. Maintainability d.
    10·1 answer
  • A user has been given Full Control permission to a shared folder. The user has been given Modify permission at the NTFS level to
    11·1 answer
  • Which command should you enter to configure a single port to discard inferior bpdus 200-125?
    5·1 answer
  • How do you determine latitude using an astrolabe?
    11·1 answer
  • List some good names for devices on your home network or on the network in your school's lab. Demonstrate the use of best practi
    13·1 answer
  • One key to success in a career is to be an accomplished
    15·1 answer
  • Can someone solve this for me please? It’s part of an escape room.
    13·2 answers
  • This code --> plt.plot(x,y) is used to draw :
    8·1 answer
  • you manage a network that has multiple internal subnets. you connect a workstation to the 192.168.1.0/24 subnet. this workstatio
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!