Question

(Python) For the list liss do the following: ##liss = ['o,no!', -1, 'why?', 8, 0, 'yes',...

(Python) For the list liss do the following:
##liss = ['o,no!', -1, 'why?', 8, 0, 'yes', 'not, really']
#####append "hi" to the end
#####find the index of "yes" in the new liss list
#####insert 'what?' to the third place
#####extract string part of the liss and sort it
####$$$$$$$$ If your code works - it is acceptable, if it does not - it is not acceptable.

#########remove and del
######## let us get the list
##li = [1, 2, 6, 'yes']
##########we want to remove the item 2:
##li.remove(2)
##print(li)
###########we want to delete the element with index 2 from the new list li:
##del li[2]
##print(li)

Homework Answers

Answer #1
liss = ['o,no!', -1, 'why?', 8, 0, 'yes', 'not, really']
###append "hi" to the end
liss.append("hi")
print(liss)
###find the index of "yes" in the new liss list
print(liss.index('yes'))
###insert 'what?' to the third place
liss.insert(3, 'what?')
print(liss)
###extract string part of the liss and sort it
# what does it mean by extracting string part?
##$$$$$$$$ If your code works - it is acceptable, if it does not - it is not acceptable.

#######remove and del
###### let us get the list
li = [1, 2, 6, 'yes']
########we want to remove the item 2:
li.remove(2)
print(li)
#########we want to delete the element with index 2 from the new list li:
del li[2]
print(li)
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
(Python) ######new part: append method ######we have a list ##lis = [1,'a',8, 0] ##print(lis) ########to append...
(Python) ######new part: append method ######we have a list ##lis = [1,'a',8, 0] ##print(lis) ########to append "yes" to the list: ##lis.append('yes') ##print(lis) ########index method: let us find the index of 'yes': ##index_yes = lis.index('yes') ##print(index_yes) ## here you cam see that it is 4, as it must be ########insert method: we want to put 'o, no!' in the list at the first place: ##lis.insert(0, 'o,no!') ##print(lis) ########### sort method: we wnat to sort out list; for our regrets sorting is...
1. What will the following python code display? num = list(range(5)) print(num) 2. Answer the following...
1. What will the following python code display? num = list(range(5)) print(num) 2. Answer the following questions using the list below. You can record your answers in the essay textbox. data = [5,3,7] A. Write code to replace the value in the 0 position with the number 8. B. Add the value 10 to the end of the list. C. Insert the value 22 after position 1 in the list. D. Remove the value at position 2. E. Sort the...
Use Python to Complete the following on a single text file and submit your code and...
Use Python to Complete the following on a single text file and submit your code and your output as separate documents. For each problem create the necessary list objects and write code to perform the following examples: Sum all the items in a list. Multiply all the items in a list. Get the largest number from a list. Get the smallest number from a list. Remove duplicates from a list. Check a list is empty or not. Clone or copy...
1. let us create a python class called Star(). Write Star() such that an instance (s1)...
1. let us create a python class called Star(). Write Star() such that an instance (s1) of a star is created with the call s1=Star(…) where the calling parameters of Star() define all the information of the star, including, at least, name, distance, surface temperature and radius. Look these up for your favorite star and run a main that proves it works. 2. Next, create a second class called Information(). It will have zero calling parameters and just one item...
convert code from python to cpp L = [2,7,4,19,45,16,9,13,8,69,55,11,23,98,14,5,1,3]   #Merging function def merge(M,N): merging_list = []...
convert code from python to cpp L = [2,7,4,19,45,16,9,13,8,69,55,11,23,98,14,5,1,3]   #Merging function def merge(M,N): merging_list = []        //create empty list to merge the lists M and N if not M:                //if M is empty list, m = 0                //set m = 0 else: m = len(M)             //otherwise, set m = len(M) if not N:                //if N is empty list, n = 0       ...
PYTHON------------ Task 1- Remove Number Complete the function remove_number such that given a list of integers...
PYTHON------------ Task 1- Remove Number Complete the function remove_number such that given a list of integers and an integer n, the function removes every instance of n from the list. Remember that this function needs to modify the list, not return a new list. Task 2- Logged List The log2() function is one of an algorithm designer’s favourite functions. You’ll learn more about this later, but briefly – if your input size is 1048576 elements, but you only look at...
Write a code in c++ using linear insertion following the steps below. Comment your work. 1....
Write a code in c++ using linear insertion following the steps below. Comment your work. 1.    Ask the user for the name of a file containing data. If it does not exist, the program should display an error, then ask for a new file name. Entering an asterisk (*) as the first and only character on a line should terminate the program. 2.     You can use a statically-allocated one-dimensional array of doubles for this with length 100. You...
Using the given SList as a template to implement a doubly linked list with the following...
Using the given SList as a template to implement a doubly linked list with the following functionalities Add first: add an element to the head of the list Add last: add an element to the end of the list Print: print the content of the list starting from the head Find: a private method that will return a reference to a node if it contains the same value of a given argument Insert after: a method that takes a key...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop a class, using templates, to provide functionality for a set of recursive functions. The functions specified as recursive must be written recursively (not iterativly). The UML class specifications are provided below. A main will be provided. Additionally, a make file will need to be developed and submitted. ● Recursion Set Class The recursion set template class will implement the template functions. recursionSet -length: int...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop...
STRICT DOWNVOTE IF NOT DONE FULLY, WILL REPORT ALSO IF COPY PASTED OR MODIFIED ANSWER Develop a class, using templates, to provide functionality for a set of recursive functions. The functions specified as recursive must be written recursively (not iterativly). The UML class specifications are provided below. A main will be provided. Additionally, a make file will need to be developed and submitted. ● Recursion Set Class The recursion set template class will implement the template functions. recursionSet -length: int...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT