Can I have some help making a
1. Create an empty list called names_list.
2. Create an empty list called split_names_list.
3. Use a loop to repeat the following steps 5 times:
a. Prompt the user to enter a name in the format "LastName-FirstName" and store it in a variable called name.
b. Append the name to the names_list.
4. Use a loop to iterate over each name in names_list:
a. Split each name based on the '-' character and store the resulting last name and first name in variables.
b. Create a tuple containing the last name and first name.
c. Append the tuple to the split_names_list.
5. Print "Split Names:" to the console.
6. Use a loop to iterate over each tuple in split_names_list:
a. Print the last name and first name in the format "Last Name: [last_name], First Name: [first_name]" to the console.
7. End the program.
Step by stepSolved in 3 steps with 1 images
- Please help me, create your won code Create a function that takes a 2D list and an integer v, and returns the number of times the value v is in the list of lists. Add the Nsteps variable to count how many times the loops execute and display a message.• The main program must give a 2D list (no need to generate it, just create it manually), call the function, and display the result example it's the picturearrow_forwardWhen using a for-loop to modify a list, you always have to make a copy of the list. (a) True (b) False Thank you!arrow_forwardGenerate a random list of 150 integers. Calculate the Standard Deviation of the List. Ask the user for an integer and determine if its exceptional or not.arrow_forward
- I have given you the linear search code example on the video and I want you to go through the code and adjust the code. In the following code, list consists of number 4 twice however when you execute this code you find only the first 4. Please adjust your code to find both 4’s on the list def linear_search(list1,key): for i in range(len(list1)): if key==list1[i]: print("Element is found at index", i) break else: print("The element is not found") list1=[4,5,10,4,9,21] key=int(input("Enter a key number: ")) linear_search(list1,key)arrow_forwardA list called parts has already been created and filled with data. It has a length of 5. Write a for loop that prints each value in this list.arrow_forwardIn NumPy write a program to generate a list that contain 5 random integers in the range 1 to 100. Display the list in the output.arrow_forward
- python LAB: Subtracting list elements from max When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers. Write a program that adjusts a list of values by subtracting each value from the maximum value in the list. The input begins with an integer indicating the number of integers that follow.arrow_forwardWrite a program that uses 2 lists. Call the lists Items and Basket respectively. The first list will contain a list of at least 10 items (make up your own items) to select from. The second list will be used to add the selected items in the new list.(Basket) Your program should do the following in a Loop until the user exits the loop: Display the list (print out 1, 2, 3, 4, etc. before each item in the list (Hint: Use Index + 1) Prompt the user to select an item from the Items list. Add the selected item to the new list (Basket) (HINT: Use number entered - 1 for the Index) When the user selects 0, exit the loop and print out the new list of items (Basket) Use Microsoft Word to create your Outline and Logic sections. You can copy and paste your Python code at the end under the heading "Code:" Upload your work into the assignment when completedarrow_forwardGiven a string with duplicate characters in it. Write a program to generate a list that only contains the duplicate characters. In other words, your new list should contain the characters which appear more than once. Suggested Approach Used two nested for loops. The first for loop iterates from 0 to range(len(input_str)). The second for loop iterates from first_loop_index + 1 to range(len(input_str)). The reason you want to start at first_loop_index + 1 in the nested inner loop is that the outer loop already checks the current character. In the nested inner loop, you want to check the remaining characters in the input string. If the current character of the outer loop matches the character of the nested loop AND the character is not already IN the duplicate list, append it to the list nhantran Sample Output 1 List of duplicate chars: ['n', 'a'] Sample Input 2 pneumonoultramicroscopicsilicovolcanoconiosis Sample Output 2 List of duplicate chars: ['p', 'n', 'u', 'm', 'o', 'l', 'r', 'a',…arrow_forward
- Using Clojure Write a procedure, called count-to-1, that takes a positive integer n, and returns a list of the integers counting down from n to 1.arrow_forwardWritten in python with docstrings if applicable. Thanksarrow_forwardFor this project you will create a program that populates a list of 8 car manufacturers. You can have theuser populate the list or you can have it predefined.(your choice)If you used a predefined list, then ask the user to add a car manufacturer to the list,Example:cars = ['Ford', 'BMW', 'Volvo']print(‘Enter a new Car Manufacturer: ’)cars.append(input())Use the len() function to acquire the length of the list.(this number is used at the end)Example:cars = ['Ford', 'BMW', 'Volvo']length = cars.len()Use the sort() function to sort the list, (Sort before it is displayed at the end)Example:cars = ['Ford', 'BMW', 'Volvo']cars.sort()and displays the contents of the list using a for loop in the following format:The 9 car manufacturers are:BMWFordVolvoarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education