subject
Computers and Technology, 11.06.2020 03:57 yuu59

The main() module in the starter code below takes integar inputs separated by commas from the user and stores them in a list. Then, it allows the user to manipulate the list using 3 functions: mutate_list() takes 3 parameters -- a list, index number, and a value -- and inserts the value in the position specified by the index number in the list.
remove_index() takes 2 parameters -- a list and an index number -- and remove the element at the position number indicated by index. It also prints the total number of elements in the list before and after removing the character in this fashion:"Total elements in list = 11
Total elements in list = 10"
reverse_list() takes 1 parameter -- a list -- and returns the list reversed.
Examples:
Example 1:
Enter values in list separated by commas: 1,2,4,63,6,4,22,53,76
[1, 2, 4, 63, 6, 4, 22, 53, 76]
Menu:
mutate list(m), remove (r), reverse_list (R)
Enter choice (m, r,R): m
4,45
[1, 2, 4, 63, 45, 6, 4, 22, 53, 76]
Example 2:
Enter values in list separated by commas: 1,2,4,6,84,3,2,2,76
[1, 2, 4, 6, 84, 3, 2, 2, 76]
Menu:
mutate list(m), remove (r), reverse_list (R)
Enter choice (m, r,R): R
[76, 2, 2, 3, 84, 6, 4, 2, 1]
Example 3:
Enter values in list separated by commas: 12,2,3,5,2,6,2,1,2,333,65
[12, 2, 3, 5, 2, 6, 2, 1, 2, 333, 65]
Menu:
mutate list(m), remove (r), reverse_list (R)
Enter choice (m, r,R): r
Example 4
Total elements in list = 11
Total elements in list = 10
[12, 2, 3, 5, 6, 2, 1, 2, 333, 65]
please use the codes below
def main():
user_list = input("Enter values in list separated by commas: ")
user_list = user_list. split(",")
user_list = [int(i) for i in user_list]
print(user_list)
print("Menu: ")
print("mutate list(m), remove (r), reverse_list (R)")
user_choice = input("Enter choice (m, r,R): ")
if user_choice == 'm':
index_num, v = input().split(",")
index_num = int(index_num)
v = int(v)
mutate_list(user_list, index_num, v)
print(user_list)
elif user_choice == 'r':
index_num = int(input())
remove_index(user_list, index_num)
print(user_list)
elif user_choice == 'R':
new_list = reverse_list(user_list)
print(new_list)
main()

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:40
Kali, a python programmer, is using the turtle module to write the word “hello.” which code should she use to indicate the location to begin writing the word? a # pick up the turtle and move it to its starting location. b penup(-100, 200) goto() pendown() c penup() goto(-100, 200) pendown() d # pick up the turtle and move it to (-100, 200)
Answers: 2
question
Computers and Technology, 22.06.2019 18:40
Mariah was working on a multimedia presentation that included both video and audio files. the file was huge, and she wanted to send it to her coworker in another office. she needed to reduce the size of the file so that it could be transmitted faster. the utility she used to do this was
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Me ! evelyn is a manager in a retail unit. she wants to prepare a report on the projected profit for the next year. which function can she use? a. pmt b. round c. division d. what-if analysis
Answers: 2
question
Computers and Technology, 23.06.2019 22:00
Take a critical look at three gui applications you have used—for example, a spreadsheet, a word-processing program, and a game. describe how well each conforms to the gui design guidelines listed in this chapter.
Answers: 3
You know the right answer?
The main() module in the starter code below takes integar inputs separated by commas from the user a...
Questions
question
Physics, 17.02.2021 22:00
question
English, 17.02.2021 22:00
question
Mathematics, 17.02.2021 22:00
question
Mathematics, 17.02.2021 22:00
Questions on the website: 13722359