Question
Write a user defined function arrangelements(X),that accepts a list X of integers and sets all the negative elements to the left and all positive elements to the right of the list.

For example:
if L =[1,-2,3,4,-5,7] ,
Then the output should be: [-2,-5,3,4,7]

Answer

Get the step-by-step solution for this question inside the Vidyadip app.

Get the answer in the app

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free

Similar questions

Write a Python program to accept the list from the user and print the odd position elements of the list.
What are the adverse effects of e-Waste?
Python program to get the difference between the two lists.
Write the output of the following script/code

The data is about Time devoted by a student in various subject = 'English', 'Physics', 'Chemistry', 'Mathematics', 'Comp. Sci.' time (in hours) = 0.3, 1.5, 1.5, 2, 0.4. Write a python program to draw PIE chart for the above data.
What are the positive effects of technology?
Write a script to create an empty list and then
(a) Input 10 numbers from the users and store them in the list using append() method
(b) Find the sum of all the even elements present in the list

Consider the following table Bank.

Table: Bank

AccNo Cust_name FD_Amount Months Int_Rate FD_Date
1001 Arti Gupta 30000 36 6.00 2018-07-01
1002 Dilip Lal 50000 48 6.75 2018-03-22
1003 Navin Gupta 30000 36 NULL 2018-03-01
1004 D.P. Yadav 80000 60 8.25 2017-06-12
1005 Jyoti Sharma 20000 36 6.50 2017-01-31
1006 Rakesh Kumar 70000 60 8.25 2018-06-15
1007 K.D. Singh 50000 48 NULL 2018-07-05
1008 Anjali Sharma 60000 48 6.75 2017-04-02
1009 Swati Garg 40000 42 6.50 2018-06-15
1010 Rupinder Kaur 25000 36 6.50 2018-09-27

Write SQL commands for the statements (a) to (h) on the table Bank
(a) Display the details of all FD whose rate of interest is in the range 6% to 7%.
(b) Display the Customer Name and FD Amount for all the loans for which the number of Months is 24, 36, or 48(using IN operator).
(c) Display the Account Number, Customer Name and FD Amount for all the FD for which the Customer Name
ends with “Sharma”.
(d) Delete the records of “Rupinder Kaur”.
(e) Add another column Maturity_Amt of type Integer in the Bank table.
(f) To find the average FD amount. Label the column as “Average FD Amount”.
(g) To find the total FD amount which started in the year 2018?
(h) Update Maturity Amount of all bank customers.
a. Maturity Amount = (FD_Amount*Months* Int_rate)/(12*100)

Write the output produced by the following SQL commands:

Which protocol helps us to transfer files to and from a remote computer?