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
prisoha [69]
3 years ago
10

Write a function swap that swaps the first and last elements of a list argument. Sample output with input: 'all,good,things,must

,end,here' ['here', 'good', 'things', 'must', 'end', 'all']
Computers and Technology
2 answers:
asambeis [7]3 years ago
8 0

Answer:

def swap(li):

   n=len(li)

   li[0],li[n-1]=li[n-1],li[0]

   return li

Explanation:

Python is very user friendly language and and this provides numerous functions and in-built services. In the above function, i have created a method which is taking an argument li and we can find the length of li by using method len() which is then stored in variable n. Now we have to swap first and last element so, first element of li is li[0] and last is li[n-1]. Python provides one more utility in which we can change values of 2 elements simultaneously by separating them with comma. So, we put the value of last element in first and value of first in last which saved many lines of code.

zubka84 [21]3 years ago
7 0

Answer:

li=list(map(str,input().strip().split()))#taking input of the string.

#swapping first and last element.

temp=li[0]

li[0]=li[-1]

li[-1]=temp

print(li)#printing the list.

Explanation:

I have taken the list li for taking the input of strings.Then after that swapping first and last element of the list.Then printing the list.

You might be interested in
Which of the following is not a true statement? You can import a table or a query directly from an Access database into an Excel
Lilit [14]

Answer:

does anybody know this answer?

Explanation:

no nobody does

5 0
4 years ago
in order to switch from paper to digital medical records the hospital bought in several individuals to introduce and implement t
VladimirAG [237]

Available options are:

A. Technical champions

B. Engaged filmmakers

C. Business partners

D. Compliance champions

Answer:

Technical champions

Explanation:

Given that a "Technical Champion" is someone whose responsibility is to introduce and perform the role of enabling the use of technology, development of skills across the organization, and strengthen communication between Information Technology and the staff or employees.

Hence, in this case, considering the job descriptions described in the question above, these individuals would best be described as TECHNICAL CHAMPIONS

6 0
3 years ago
The Web team you manage is designing a new Website for a company that wants to reach a specific audience. After discussing the c
____ [38]

Answer:

Cultural diversity

Explanation:

Cultural diversity can be described as having a variety of cultures in the same area.

Culture on its own means beliefs, customs, and traditions of a specific group of people. It simply means the way of life of a people.

Cultural diversity usually fosters cultural unity in most cases becsuse the different cultures always tend to do everything together.

The design plan that encourages the use of two or more languages and the use of a recommended colour in creating a webpage in a place that has multiple ethnic groups is cultural diversity approach. As this puts into consideration all the cultures in its design.

4 0
3 years ago
A ___________ variable is declared outside all functions.
velikii [3]

Answer:

B. global

Explanation:

A global variable lives on even when a function returns.

7 0
4 years ago
If wire rope guardrails are used, what also must be done?
inn [45]
Some sort of security  pole to hold the 2 ends together firmly <span />
6 0
3 years ago
Read 2 more answers
Other questions:
  • A(n) _____ is the highest educational degree available at a community college. master bachelor associate specialist
    13·2 answers
  • What filter gives a “squeezed” effect to an image?
    14·2 answers
  • Which of the following statements invokes the GetDiscount function, passing it the contents of two Decimal variables named decSa
    8·1 answer
  • When activated, an Excel object has all the features of an Excel
    8·2 answers
  • Who develop punch card​
    7·1 answer
  • Which CSS attribute would change an element's font color to blue
    15·2 answers
  • Problem: Mr. James Reid, the director of admissions at MOGCHS University, has
    14·1 answer
  • Ian kno da answer tell me
    7·2 answers
  • Write a python program that should determine from the range you choose to enter :
    9·1 answer
  • Determine which system you would recommend each of the customers use based on their provided user and system specs.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!