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
The development methodology where each part of a project is done in order after each other is called:
Oksanka [162]

Bruh this a duplicate

8 0
3 years ago
Which daemon manages the physical memory by moving process from physical memory to swap space when more physical memory is neede
Anastasy [175]

Answer:

Swap daemon

Explanation:

Swap daemon manages the physical memory by moving process from physical memory to swap space when more physical memory is needed. The main function of the swap daemon is to monitor processes running on a computer to determine whether or not it requires to be swapped.

The physical memory of a computer system is known as random access memory (RAM).

A random access memory (RAM) can be defined as the internal hardware memory which allows data to be read and written (changed) in a computer.Basically, a random access memory (RAM) is used for temporarily storing data such as software programs, operating system (OS),machine code and working data (data in current use) so that they are easily and rapidly accessible to the central processing unit (CPU).

Additionally, RAM is a volatile memory because any data stored in it would be lost or erased once the computer is turned off. Thus, it can only retain data while the computer is turned on and as such is considered to be a short-term memory.

There are two (2) main types of random access memory (RAM) and these are;

1. Static Random Access Memory (SRAM).

2. Dynamic Random Access Memory (DRAM).

6 0
3 years ago
New evidence can lead to a change in scientific knowledge.<br><br> A. True<br> B.False
lidiya [134]

ιт ιѕ (α.) тяυє ιf уσυ fιи∂ иєω киσωℓєgє σи ∂σмєтнιиg ιт ¢αи ¢нαиgє ѕ¢ιєи¢є

ℓιкє нσω тнєу υѕє∂ тσ вєℓινє тнє єαятн ωαѕ fℓαт,σя нσω тнє єαятн ωαѕ тнє ¢єитєя σf тнє υиινєяѕє

нσρє ι ¢συℓ∂ нєℓρ уσυ!!!!!!!!

3 0
3 years ago
Read 2 more answers
The company that you work for has recently had a security breech. During the recover and assessment, it was discovered that the
mars1129 [50]

Answer:

I recommend Digital Certification of User through trusted certification Authority, who is requesting to access the company website through VPN to make sure the identity of the user.

Explanation:

Digital Certificate is the type of identity key or certificate that is assigned to the users as per their request. It is a unique number that is assigned to the user to ensure the authentication that Who are you. It is same like our identity card number that shows our identity to someone as per requirement.

These certificates are issued by certification organizations that are registered or trusted. If the users are using VPN on their devices to access some website that may not be a trusted user or a malware that can hurt the company by breaching the security protocols. So, some companies didn't allow untrusted users to websites.

<em>Therefore, I recommend to my company that, they should ensure that the users that are trying to access the website through VPN must have some digital Certificate from trusted certification authority to ensure the identity of the users.</em>

<em />

6 0
4 years ago
You can separate words in a macro name by using the ____ character
Maru [420]
You can separate words in a macro name by using the underscore character.

A macro is considered as a small reusable computer program. It is efficient as it helps you save time by automating any repeated task.
In order to create a macro, you do not need to be an expert in programming, however, a little knowledge about it will help.

8 0
3 years ago
Read 2 more answers
Other questions:
  • 3) According to the five-component model of information systems, the ________ component functions as instructions for the people
    8·1 answer
  • A ____ is any key that uniquely identifies each row.
    15·1 answer
  • You have been given the job of creating a new order processing system for the Yummy Fruit CompanyTM. The system reads pricing in
    8·1 answer
  • "Hubs:
    9·1 answer
  • Downloading files is safe for most types of files except Select one: a. documents. b. pictures. c. executable files. d. music fi
    7·1 answer
  • Create a pseudocode program that asks students to enter a word. Call a function to compute the different ways in which the lette
    9·1 answer
  • Describe the functions of a system software​
    6·2 answers
  • When you call a method with a parameter list, the arguments in the argument list Select one: a. must be coded in the same sequen
    15·1 answer
  • You have received an update package for a critical application you are running on a virtual machine. You have been told to insta
    8·1 answer
  • Which file type is the best choice if the image will be made into a billboard?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!