PYTHON CODE Write a function list3Digit10() that creates and returns a list that contain all positive 3-digit numbers that are multiples of 10. The function call list3Digit10() will return a list containing 100, 110, 120, ..., 990.
Q: Write a function that returns the greatest common divisor (GCD) of integers in a list. Use the…
A: NOTE: SINCE THE LANGUAGE OF THE CODE IS NOT MENTIONED, I HAVE USED PYTHON FOR THE SOLUTION. Define…
Q: Using the ListNode structure introduced in this chapter, write a function void printFirst(ListNode…
A: Given: void printFirst(ListNode *ptr)
Q: Create a function that determines the elements in a list that can be rearranged to create a sequence…
A: Approach: Sort all the elements. Do a linear scan of the sorted array. If the difference between the…
Q: Write a function that accepts a list as an argument and calculates the sum of each element of the…
A: Program: Programs are used to interact with computer systems and solve complex problems. The main…
Q: The function that will a single items to the list is Oextend (...) Oadd(...) Oappend(...)…
A: The above question is solved in step 2 :-
Q: In Python Write and test a function to meet this specification. toNumbers(strList) strList is a…
A: def toNumbers(strList): #function to convert list of strings to list of integers…
Q: 6- Write a lambda function that finds the average of arguments a, b, and c and prints the result. 7-…
A: I give the code for both 6 and 7 in Python along with output and code screenshot
Q: Functions, Iterations and List Write a function that takes a positive integer n as its parameter. •…
A: NOTE - Here I have used the Java programming language Here I have created a function named…
Q: Write a Python function named uniqueNumbers that generates 10 unique numbers between 50 and 80 and…
A: Code : import randomdef uniqueNumbers(a,b): mylist=[] for i in range(0,10):…
Q: Write a function in Ocaml summax2 : int list -> int = that takes an int list and returns the sum of…
A: (* Write a function max3 of type int * int * int -> int that returns the largest of three…
Q: Question-1: Write a python code that takes a string as an user input and finds out all the duplicate…
A: I will provide you a commented python code. So just read the code once and you will easily…
Q: python Write a function lottery() that simulates simple lottery program. This lottery program works…
A: import randomfrom operator import eqmenu_check = True# 'checker', compares userNums and winningNums…
Q: Write a function that returns a new list by eliminating the duplicate values in the list. Use the…
A: note: we are only allowed to solve one question in one post. please post-second question in a…
Q: Write a function for the user to enter a positive integer n with a value between 10 and 1000. If…
A: Q: As per bartleby policy, we can only answer one part per question. Please post other parts in a…
Q: Python Programming: 2D list The Lo Shu Magic Square is a grid with 3 rows and 3 columns that…
A: Actually, array is a collection of elements.
Q: You can shuffle a list using random.shuffle(lst). Write your own function without using…
A: PROGRAM CODE: import random // import the random library def shuffle(lst):…
Q: Comma Code Say you have a list value like this: spam = ['apples', 'bananas", 'tofu', 'cats'] Write a…
A: NOTE: Since the question doesn't mention the programming language use to code so I am using Python…
Q: The reverse function in Section 10.8 reverses a list by copying it to a new list. Rewrite the…
A: In Python, lists are used to store multiple items in a single variable. Lists are mutable type its…
Q: Write the following function that returns true if the list is already sorted in increasing order:def…
A: In the given problem we will use python 3 code, def isSorted(list): for x in range(len(ll)-1):…
Q: Python programming. For this program, you need to write a function that processes a list, then…
A: Python Program def compound_interest(p, i, t): # Calculates compound interest Amount =…
Q: PYTHON 3 def get_graded(infolist): """ param: infolist - a list that contains dictionaries…
A: grades = [] for d in infolist: if d["grades"] != []:…
Q: list is an array of five elements of int type. What is stored in list[2] after the code is executed?…
A: Here in this question we have given a c++ code segment and we have asked to find the output of…
Q: CH7: Problem 1: Lo Shu Magic Square 15 The Lo Shu Magic Square is a grid with 3 rows and 3 columns,…
A: Python code: def generateSquare(n): # 2-D array with all # slots set to 0 magicSquare = [[0 for x…
Q: listElement (list, 6): when int listf6] -/23.14.3.-6,36,85;: and the function listElement is: void…
A: #include <bits/stdc++.h> using namespace std; void listElement(int [],int); int main(){ int…
Q: Python Programming Write a program that asks the user to enter a series of ten numbers. The program…
A: Program Plan: Create function numberOperration() to compute lowest, highest, total, and average. Use…
Q: Python program Write a program in python language that has a list and we have to remove the…
A: Here have to determine about python code for remove duplicate element.
Q: Write a function that accepts a list as an argument (assume the list contains integers) and returns…
A: def getTotal(list): total = 0 for item in list: total = total + item return total
Q: Guess a letter: w wallaby You win! # The program selects the word platypus Guess a letter: b…
A: The given python code is examined and the respective needed changes are done on the given code and…
Q: Create a Flowchart for this code. #Declaring and initializing the list cars =…
A:
Q: Using the mapped list pattern, write a function cubes (data) that returns a list of the cubes of all…
A: Given:
Q: 4.) A certain CS professor gives 5-point quizzes that are graded on the scale 5-A, 4-B, 3-C, 2-D,…
A: In this question we will write a python program the given program that accepts a quiz score as an…
Q: An activity is carried out with many people, of which the only requirement of the activity is to be…
A: According to the guideline I need to answer only one question in a question but you asked 2…
Q: Write an application that accepts up to 20 Strings, or fewer if the user enters a terminating…
A: while (str.equals(sentinel) != true && count < 20) { if (str.length() <= 10) {…
Q: Write the following function that tests whether the list has four consecutive numbers with the same…
A: #declarer functiondef isConsecutiveFour(values): #return the values return sorted(values) ==…
Q: isupper() checks if all the letters in a string upper case. the task is to write a program that will…
A: all() function returns true only if all values are true else false. for() is used for iteration. We…
Q: Python Qu Write a Python program (not a function!) that asks the user for nonnegative integers, one…
A: Sample Output1: Sample Output 2
Q: python question: Write a code that takes a sentence as an argument and places its words in a list…
A: #method that takes sentence as argument and places its words#in a list in alphabetical order and…
Q: only_evens ( [1, 2, 3]) >>> [2] only_evens([1, 5, 3]) [] only_evens ( [4, 4, 4]) [4, 4, 4] >>> >>>
A: Given: In python create function that returns even numbers in a list form using only while loop and…
Q: In a program, write a function that accepts two arguments: a list, and a number n. Assume that the…
A: Since programming language not mentioned using python.
Q: About initial programming in python: Create a function that receives as parameters a list of 4…
A: We will create a function. This function will receive a list and a number. If the number is in the…
Q: The two-dimensional lists m1 and m2 are identical if they have the same contents. Write a function…
A: Given: The two-dimensional lists m1 and m2 are identical if they have the same contents. Write a…
Q: Write the following function that returns the location of the largest element in a two-dimensional…
A: According to the Question below the Solution: Output:
Q: Exercise 6: Write a Python program that reads integer numbers and adds them to a list if they are…
A: #list to store valuesvalues = [] #variable to count the valuescount = 0 #loop to read inputswhile…
Q: For this project you will create a program that populates a list of 8 car manufacturers. You can…
A: SOLUTION-I have solve the problem in python code with comments and screenshot for easy…
Q: Python code Python Write a function named `freq(l)` that takes a list `l` of numbers and returns…
A: Here is the python3 code: See below step for code and output.
Q: Python write a program in python that plays the game of Hangman. When the user plays Hangman, the…
A: Python Code for word guessing game Hangman
Q: A contact list is a place where you can store a specific contact with other associated information…
A: using namespace std; #include <iostream> #include <vector> #include <string>…
Q: A contact list is a place where you can store a specific contact with other associated information…
A: PROGRAM: //Header file import java.util.Scanner; //Defining Class class LabProgram{…
Q: (Using Python)Write a function that returns a new list by eliminating the duplicate values in the…
A: Actually, python is a easiest programming language. It is a dynamically typed programming language.
PYTHON CODE
Write a function list3Digit10() that creates and returns a list that contain all positive 3-digit numbers that are multiples of 10. The function call list3Digit10() will return a list containing 100, 110, 120, ..., 990.
Step by step
Solved in 2 steps with 1 images
- python question: Write a code that takes a sentence as an argument and places its words in a list of words in alphabetical order If the sentence is: "Am I good" The function returns: ['Am', 'I', 'good']a- Write a Python function Salary_levels, that takes a list as an argument and returns the number of the high salaries (salary>=5000), the average salaries(1000<=salary<5000, and the low salaries (salary<1000). You can use the following list : salaries= [500,1070,1450,6500,9000,940,450,400,600,2750,1100,8400,1500,900,1200] b- Use the above function to print the counts of the high, average, and low salaries. N.B: the codes of parts a and b should be included in your answer.***python only*** Write a function votes_by_race() which takes a list of dicts as a parameter and returns a dict. For example, given the following list: votes = [{'for': 'A, 'age': 35, 'race': 'w'}, {'for': 'B', 'age': 40, 'race': 'b'}, {'for': 'B', 'age': 20, 'race': 'b'}, {'for': 'A', 'age': 30, 'race': 'a'}, {'for': 'A', 'age': 41, 'race': 'w'}, ] The call votes_by_race(votes) should return the following dict:{"White": 2, 'Black': 2, 'Asian': 1, "Hispanic': 0}
- Exercise, maxCylinderVolume F# system function such as min or methods in the list module such as List.map are not allowed Write a function maxCylinderVolume that takes a list of floating-point tuples that represent dimensions of a cylinder and returns the volume of the cylinder that has the largest volume. Each tuple has two floating point values that are both greater than zero. The first value is the radius r and the second value is the height h. The volume of the cylinder is computed using ??2h. The value π is represented in F# with System.Math.PI. If the list is empty, return 0.0. Examples: > maxCylinderVolume [(2.1, 3.4); (4.7, 2.8); (0.9, 6.1); (3.2, 5.4)];;val it : float = 194.3137888> maxCylinderVolume [(0.33, 0.66)];;val it : float = 0.2257988304Code in python Given a list, L, the function front_two creates a new list of length 2 out of the first two items in L as follows: In the new list, the second item becomes the first item, and the first item becomes the second. If L contains only one item, the first item in the new list should be the value None. If L is empty, both items in the new list should be value None. The function returns the new list. For example: Test Result L = ['a', 'b', 'c', 'd'] print(front_two(L)) ['b', 'a'] L = [] print(front_two(L)) [None, None] L = [5, 2] print(front_two(L)) [2, 5] L = [7] print(front_two(L)) [None, 7]Yahtzee! Yahtzee is a dice game that uses five die. There are multiple scoring abilities with the highest being a Yahtzee where all five die are the same. You will simulate rolling five die 777 times while looking for a yahtzee. Program Specifications : Create a list that holds the values of your five die. Populate the list with five random numbers between 1 & 6, the values on a die. Create a function to see if all five values in the list are the same and IF they are, print the phrase "You rolled ##### and its a Yahtzee!" (note: ##### will be replaced with the values in the list) Create a loop that completes the process 777 times, simulating you rolling the 5 die 777 times, checking for Yahtzee, and printing the statement above when a Yahtzee is rolled. When you complete the project please upload your .py file to the Project 2 folder by the due date.
- Write a function list2DigitOdd() that creates and returns a list that contain all positive 2-digit odd numbers. The function call list2DigitOdd() will return a list containing 11, 13, 15, ..., 99.PYTHON CS1 PROBLEM Define a function that takes a list of lists, glol, as a parameter. You may assume that the inner lists in glol are lists of positive integers. Your function should return True if at least one of the inner lists in glol contains two or more multiples of 10. Otherwise it should return False. For example: If glol = [ ] then your function returns False. If glol = [[ ], [4, 2]] then your function returns False. If glol = [[10, 2, 6, 8], [12, 6], [15, 20, 5]] then your function returns False. If glol = [[10, 2, 6], [12, 6], [10, 2, 70, 15], [15, 10, 5]] then your function returns True as the inner list [10, 2, 70, 15] contains 10 and 70. If glol = [[10, 2, 6], [12, 6], [10, 7, 15], [50, 10, 50, 4, 6]] then your function returns True as the inner list [50, 10, 50, 4, 6] contains 50 twice. 6. If glol = [[10, 20, 6, 90], [12, 6], [ 7, 3, 15], [50, 10, 50, 4, 7]] then your function returns True as the inner lists [50, 10, 50, 4, 7] and [10, 20, 6, 90] contain more…two_sum is a Python function that takes in a list of integers (elements) and an integer number (num) and returns True if there exist two values in elements that add up to num, otherwise, function returns False. def two_sum(elements: List[int], num: int): for i in range(len(elements)): for j in range(i + 1): if elements[i] + elements[j] == num: return True return False Study above function and answer below questions: A. What is time complexity of two_sum? B. Is it possible to improve on above algorithm performance (in terms of its asymptotic cost)? If yes, describe your algorithm, be detailed as much as possible.
- The Python function fourthMultLast below should take a list of numbers as input and return the sum of the third element and the last element of the list. For example, if the input list is 1,2,3,4,5,6,7,8,9, the function should return 36 which is the multiply 4 and 9. ############ ###### ##### 1def fourthMultLast (inList): ans = inList[4] 2 3 return ans #####; #### ##### There is an Error on line number 2. Fix the bug. Note: You should only make changes to line number 2. For example: Test inList[-1] ### Only change this line of code fourthMultLast([1,2,3,4,5,6,7,8,9]) 36 2 3 Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30 %) Reset answer 1def fourthMultLast(inList): Precheck Result Check ans = inList[4] * inList[-1] ### Only change this line of code return ans PWrite a function that returns the greatest common divisor (GCD) of integers in a list. Use the following function header:def gcd(numbers):Write a test program that prompts the user to enter five numbers, invokes the function to find the GCD of these numbers, and displays the GCD.python exercise: 1. Write a Python function called generate_quiz_question that takes a list of quiz questions (represented as tuples of the question and answer) as input and returns a randomly selected question from the list. The function should also prompt the user to enter their answer to the question, and then check whether the user's answer is correct or not. If the user's answer is correct, the function should return True. Otherwise, it should return False.