7a. Implement the following: a) Use a for loop to create a list with 26 letters (a-z). b) Use a for loop to create a list with 26 numbers from 1 to 26 inclusive. c) Create a dictionary, charNum by zipping above two lists. d) Use a for loop to print the keys and values in the dictionary as the output below. Example Output: a 1|b 2|c 3|d 4|e 5|f 6|g 7|h 8|i 9|j 10|k 11|1 12|m 13|n 14|o 15|p 16|q 17|r 18|5 19|t 20|u 21|v 22|w 23|x 24|y 25|z 26||
Q: 2. Write a program that search a letter in a list. Save it as searchLet.py. a) Create a list named…
A: The program is written in python that accomplishes the points mentioned.
Q: 5.20 LAB: Adjust values in a list by normalizing When analyzing data sets, such as data for human…
A: We have to write a program to adjust the values by dividing all values by the largest value. The…
Q: 5 partition_list (head) This is a little like split_list() from the Short problem, except that,…
A: Given Solution: class ListNode:""" Models a single node in a singly-linked list. Has no methods,…
Q: 5.23 LAB: Adjust values in a list by normalizing When analyzing data sets, such as data for human…
A: Answer :-
Q: Use C++ A contact list is a place where you can store a specific contact with other associated…
A: A required program is as follows, File name: "main.cpp" #include <vector> #include…
Q: email address, birthday, etc. Write a program that first takes as input an integer N that represents…
A: Code: import java.util.Scanner; class Main{ public static String getPhoneNumber(String[]…
Q: Write a program that replaces words in a sentence. The input begins with word replacement pairs…
A: Answer :
Q: Create a Python file and begin with this code: FUNCTION DEFINITIONS def main(): *Create a list cats…
A: Based on Python
Q: 22) The following code accomplishes which of the tasks written below? Assume list is an int array…
A: The problem is based on finding the working of the given code.
Q: Write the remove_evens() function, which receives a list of integers as a parameter and returns a…
A: Use another list in the function where we append only the odd numbers to the list and return the…
Q: 3.9 LAB: Smallest and largest numbers in a list using min and max built-in functions NOTE1: Please…
A: This python program, initializes two lists.
Q: 1. Lists, comprehensions, loops and slicing. Save it as threeLists.py. a) Create a list…
A: EXPLANATION: - The list comprehension is used to create a list having all multiples of 4 from 0…
Q: def make_grid (w: int, h: int, player_coord: Tuple lint, int], gold_coord: Tuple[int, int]) -> List…
A: The program is written python l=[]L=[]def make_grid(w,h,player_coord,gold_coord): for i in…
Q: Use Python programming. When analyzing data sets, such as data for human heights or for human…
A: - We are given with the input as the number n - Then n elements are inputed in the list and we have…
Q: Create a function: -that takes a list and an integer v, -and returns the number of occurrences of v…
A: Have a look at the below code. I have put comments wherever required for better understanding. Code…
Q: 6. Implement the code that replaces the name of each month with its three-letter abbreviation. Save…
A: """Python program to update and display list""" #Create a months listmonths= ['january', 'february',…
Q: 1. Write a python program to eliminate all prime numbers in the list. 2. The user will input…
A: take n elements in array do input validation , value must be within 2 to 100 pass an array in…
Q: 14.8 LAB: Selection sort Write a program that takes an integer list as input and sorts the list…
A: Modified code: def selection_sort_descend_trace(lst): for i in range(len(lst) - 1):…
Q: 5. Consider the following code segment. Assume that index1 is a number between 1 and…
A: Explanation:index in an array is the position of an element in array index1 is a number between 1…
Q: Write the code to create a linked list using c++ Include the following functionality: Insert at…
A: Insert at the head or tail of the list. Following are the 6 steps to add node at the end. C++ code…
Q: I have python programing question a) Create a list comprehension of multiples of 4 from 0 to 10…
A: # All three list are declared are herel1 = [] # Answer for (c)l2 = []l3 = [] # Answer for (a) for i…
Q: Exercise 20 the string below comes from an alphabet consisting of only characters A and B.…
A: I have provided c++ code in step2.
Q: CODE THE FOLLOWING: Use loops and a list to create a sequence like 1,1,2,3,5,8,13,21,34,55 and write…
A: Algorithm Explanation: In the above program we have taken a list with initials as 1 and 1. Then…
Q: program7_1.pyWrite a Python program that creates a list of your friends. Start with an empty list…
A: Program:frd_list = []frdName = input('Enter the first name of a friend or ENTER to quit ')frdName =…
Q: 1-Let the list have a head and a tail. That is, a pointer (have a marker) to both the beginning…
A: Introduction 2-insert(int index, int element): traverse the list till the index and then add the…
Q: 1. def make_grid(w: int, h: int, player_coord: Tuple[int, int], gold_coord: Tuple[int, int]) ->…
A: 1. Answer Here is the completed code for this problem. Comments are included, go through it, learn…
Q: EXAMPLE First 10 terms of a Fibonacci series are stored in a list namiely fib fib [0, 1, 1, 2, 3, 5,…
A:
Q: Let the list have a head and a tail. That is, a pointer (have a marker) to both the beginning (first…
A: 1. 2-insert(int index, int element): traverse the list till the index and then add the node and…
Q: Complete the following function. Note that neither item_list nor index_list should be mutated. 1 | 2…
A: The program is written in python. You can check the screenshot for the correct indentation. Please…
Q: Assuming that data is a correctly created list, then the fact that lists are mutable means that the…
A: Since the python follows the zero indexing rule, there must be at least 10 elements inside the list…
Q: I. Declare two empty lists and initialize them to an empty list. II. Consider a for loop to accept…
A: Given, Steps to follow: Declare two empty lists and initialize them to an empty list. Consider…
Q: Write a program that takes an integer list as input and sorts the list into descending order using…
A: Note: The correct code and output attached below. If you have any further query please let me know…
Q: program9_1.py This assignment requires you to create a dictionary by reading the text file created…
A: """Program to create a dictionary by reading the text file, print the stats anddetermine the top…
Q: 1. Write a statement that creates a list with the following strings: 'Einstein', 'Newton', 482…
A: NOTE: According to the guidelines, the first 3 questions are answered. 1. The Python code for the…
Q: What does the following code do? Assume list is an array of int values, temp is some previously…
A: (D)It counts the number of elements in list that are less than temp Explanation: for (int j=0; j…
Q: ere is the code for number 1. def reverse_list(old_list): new_list = [ele for ele in…
A: Note: we are only allowed to solve one question in one post. Since first is already solved, I am…
Q: Complete the code to implement the following operations: Complete read_date(): Read an…
A: HERE IS COMPLETE PROGRAM WITH THEIR OUTPUT :
Q: t have a head and a tail. That is, a pointer (have a marker) to both the beginning (first Node) of…
A: It is defined as a procedural programming language which is involved in supporting structured…
Q: Lists, comprehensions, loops and slicing. a) Create a list comprehension of multiples of 4 from 0 to…
A: Algorithm : Step 1 : use list comprehension to create the first list. Step 2 : print the list. Step…
Q: 22.3 LAB: Remove all even numbers from a list Write the remove_evens() function, which receives a…
A: Remove the even numbers of the given list of array. [1,2,3,4,5,6,7,8,9]
Q: a. Find the sum of all the values of the node in the linked list. b. Print the values in the linked…
A: Structure is a user-defined datatype. It is a datatype that groups items of different datatypes into…
Q: or huma
A: Given When analyzing data sets, such as data for human heights or for human weights, a common step…
Q: 6.34 LAB: Contact list C++ A contact list is a place where you can store a specific contact with…
A: code: #include<bits/stdc++.h>using namespace std; string GetPhoneNumber(vector<string>…
Q: 1.3 dict_get Next, you will implement: char* dict_get (const dict_t* dict, const char* key); his…
A: Using the function Create a dictionary by c programming language. char* dict_get (const dict_t*…
Q: 5 partition_list (head) This is a little like split_list() from the Short problem, except that,…
A: python Python is the well general-purpose programming language that can be applied to a variety…
Q: ure that takes a tree (represented as a list) and returns a list whose elements are all the leaves…
A: Scheme code (define (leaves items)(cond ((null? items) items)((not (pair? items)) (list items))(else…
Q: Write a program that replaces the name of each month with its three-letter abbreviation. Save it as…
A: A required program is as follows, File name: "months.py" # a) Create a list months = ['january',…
Q: 1. Write two programs. The first should use traditional arrays to do each of the tasks listed below.…
A: BECAUSE YOU HAVE ASKED MULTIPLE QUESTIONS, ONLY FIRST QUESTION CAN BE SOLVED FOR YOU. IF YOU WANT…
Q: Implement the build_dictionary() function to build a word frequency dictionary from a list of words
A: Iterate over the given list and check whether each word is present or not
need help with python...paste indented code plzz
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- 11.13 (Python please) Locate the largest element) Write the following function that returns the location of the largest element in a two-dimensional list: def locateLargest(a): The return value is a one-dimensional list that contains two elements. These two elements indicate the row and column indexes of the largest element in the two-dimensional list. Write a test program that prompts the user to enter a two- dimensional list and displays the location of the largest element in the list. Here is a sample run: Enter the number of rows in the list: 3 (press enter) Enter a row: 23.5 35 2 10 (press enter) Enter a row: 4.5 3 45 3.5 (press enter) Enter a row: 35 44 5.5 11.6 (press enter) The location of the largest element is at (1, 2) (press enter)6.34 LAB: Contact list C++ A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name. Ex: If the input is: 3 Joe 123-5432 Linda 983-4123 Frank 867-5309 Frank the output is: 867-5309 Your program must define and call the following function. The return value of GetPhoneNumber is the phone number associated with the specific contact name.string GetPhoneNumber(vector<string> nameVec, vector<string> phoneNumberVec, string contactName) Hint: Use two vectors: One for the string names, and the other for the string phone numbers.Program - Python Make a dictionary, the student's name is the key (a string) and the student's test scores is the value (a list). So it should be a dictionary with six key value pairs in it. Here is data to use. Brian,94,89,92 Rachel,100,90,65 Jon,67.5,95,100 Brit,0,78,80 Greg,65,100,78 Andrea,55.5,67,79 Now print the dictionary data using a loop that starts with for key, value in.
- Implement the following:1) Store the following data into a list: 5 10 152) Use list methods to modify the list to the following: 3 5 8 10 12 173. Print each element of the list separated by a '|'. Just make sure to precisely match the output format below.Write your code in the ANSWER area provided below (must include comments if using code is not covered in the course).Example Output3 | 5 | 8 | 10 | 12 | 17 |1 - Write a Python function that will do the following: 1. Ask the user to input an integer that will be appended to a list that was originally empty. This will be done 5 times, meaning that when the input is complete, the list will have five elements (all integers). a. Determine whether each element is an even number or an odd number b. Return a list of five string elements "odd" and "even" that map the indexes of the elements of the input list, according to whether these elements are even or odd numbers.For example: if the input sequence is 12, 13, 21, 51, and 30, the function will return the list ["even", "odd", "odd", "odd", "even"].1. Lists, comprehensions, loops and slicing. Save it as threeLists.py. a) Create a list comprehension of multiples of 4 from 0 to 10 inclusive. b) Print this list as displayed in the output example.c) Create a second empty list.d) Use a loop to insert all elements from the first list to the second list. Before storing into the new list, divide each copied element by 2. This results in a new list of all multiples of 2 from 0 to 10 inclusive. e) Print the second list as displayed in the output example.f) Use slicing to copy the second list to a new third list.g) Use a loop to divide and store each element of the third list by 2. This will result in a list of the numbers 0 to 10 inclusive. h) Print the third list as displayed in the output example.
- 8.26 LAB: Word frequencies (dictionaries) Implement the build_dictionary() function to build a word frequency dictionary from a list of words. Ex: If the words list is: ["hey", "hi", "Mark", "hi", "mark"] the dictionary returned from calling build_dictionary(words) is: {'hey': 1, 'hi': 2, 'Mark': 1, 'mark': 1} Ex: If the words list is: ["zyBooks", "now", "zyBooks", "later", "zyBooks", "forever"] the dictionary returned from calling build_dictionary(words) is: {'zyBooks': 3, 'now': 1, 'later': 1, 'forever': 1} The main code builds the word list from an input string, calls build_dictionary() to build the dictionary, and displays the dictionary sorted by key value. Ex: If the input is: hey hi Mark hi mark the output is: Mark: 1 hey: 1 hi: 2 mark: 1 Use Python, please.6.44 LAB: Contact list (JAVA) A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program in java that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings), separated by a comma. That list is followed by a name, and your program should output the phone number associated with that name. Output "None" if name is not found. Assume that the list will always contain less than 20 word pairs. Ex: If the input is: 3 Joe,123-5432 Linda,983-4123 Frank,867-5309 Frank the output is: 867-5309 Your program must define and call the following method. The return value of getPhoneNumber() is the phone number associated with the specific contact name.public static String getPhoneNumber(String[] nameArr, String[] phoneNumberArr, String contactName, int arraySize) Hint: Use two arrays: One for…(Merge two sorted) Write the following function that merges two sorted lists into a new sorted list:void merge(const int list1[], int size1, const int list2[], int size2,int list3[])Implement the function in a way that takes size1 + size2 comparisons. Write a test program thatprompts the user to enter two sorted lists and display the merged list.Here is a sample run.Note that the first number in the input indicates the number of the elements in the list. This number isnot part of the list. Assume the maximum list size is 80.Enter list1: 5 1 5 16 61 111Enter list2: 4 2 4 5 6The merged list is 1 2 4 5 5 6 16 61 111
- 14.8 LAB: Selection sort Write a program that takes an integer list as input and sorts the list into descending order using selection sort. The program should use nested loops and output the list after each iteration of the outer loop, thus outputting the list N-1 times (where N is the size of the list). Code I have so far: def selection_sort_descend_trace(lst): for i in range(len(lst) - 1): max_ind = i for j in range(i + 1, len(lst)): if lst[j] > lst[max_ind]: max_ind = j lst[i], lst[max_ind] = lst[max_ind], lst[i] print(' '.join([str(x) for x in lst])) return lst if __name__ == '__main__': numbers = [int(x) for x in input().split()] selection_sort_descend_trace(numbers) Error I am getting: How do i get the brackets and comma? Input 20 10 30 40 Your output 40 10 30 20 40 30 10 20 40 30 20 10 Expected output [40, 10, 30, 20] [40, 30, 10, 20] [40, 30, 20, 10]7. Assume you already have a list defined, called name, containing three strings: aperson’s first, middle, and last name, in that order. Write an expression that produces astring consisting of the person’s last name followed by a comma and space, then the firstname and a space, then the person’s middle initial followed by a period. So, for example,if name is equal to ['John', 'Phillip', 'Sousa'], your expression will produce the string'Sousa, John P.'5.23 LAB: Adjust values in a list by normalizing When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustment can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by dividing all values by the largest value. The input begins with an integer indicating the number of floating-point values that follow. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:print('{:.2f}'.format(your_value)) Ex: If the input is: 5 30.0 50.0 10.0 100.0 65.0 the output is: 0.30 0.50 0.10 1.00 0.65 The 5 indicates that there are five floating-point values in the list, namely 30.0, 50.0, 10.0, 100.0, and 65.0. 100.0 is the largest value in the list, so each value is divided by 100.0. Use Python, please.