#construct this from a list of numbers: lists = [1,2,3,4,"5"]
#if list of numbers contains string break, result = 1"\n" 22"\n" 333"\n" 4444"\n"
#end result should look like this:
1
22
333
4444
#construct this from a list of numbers: lists = [1,2,3,4,"5"] #if list of numbers contains string break, result = 1"\n" 22"\n" 333"\n" 4444"\n" #end result should look like this: lists = [1,2,3,4,5] result = "" for i in range(1,len(lists)+1): for j in range(1,i+1): result += str(i) result += "\n" print(result)
#construct this from a list of numbers: lists = [1,2,3,4,"5"] #if list of numbers contains string...
Declare an array that contains the numbers: 1,2,3,4 (byte size). Use BX to point to the first array element initially. Subtract the second array element from the first, and store the result in the fourth element. Use the INC and DEC commands to change the array element that is pointed to. ANY assembly language.
2. Consider the following function # listOfNumbers is a list of only numbers # def processList(listOfNumbers): result = [] for i in listOfNumbers: if i<0 == 0: result.append(i*i) else: result.append((i*i)+1) return result First, study and test processList(listOfNumbers) to determine what it does Then rewrite its body so that it accomplishes the same task with a one-line list comprehension. Thus, the resulting function will have exactly two lines, the def line and a return line containing a list comprehension expression. 3....
use python
2a. Union (1 points) Make a union function which takes in 2 lists as parameters and returns a list. It should return a list that contain all elements that are in either list. Your results list should contain no duplicates. For example, if the two lists are [1,5,6,5, 2] and [3,5, 1,9] then the result list is (1,5,6,2,3,9). Note that the list sizes don't have to be equal. Note that the input lists could have duplicates, but your...
HW7.26. Return a CSV string from a list of numbers The function below takes a single parameter, a list of numbers called number_list. Complete the function to return a string of the provided numbers as a series of comma separate values (CSV). For example, if the function was provided the argument [22, 33, 44], the function should return '22,33,44'. Hint: in order to use the join function you need to first convert the numbers into strings, which you can do...
PYTHON Ask the user for an integer number n. Construct, using one single loop, the list with the values [1,2,3,4,…,n] and the list with the values [1^2 ,2^2 ,3^2 ,…n^2 ] by using list concatenation ). After this loop is over, use a separate loop to show the user the two results by printing corresponding elements from the two lists in the same line, as follows: 1 1 2 4 3 9 … …
PYTHON CODE
In a program, write a function that accepts two arguments: a
list, and a number n. Assume that the list contains numbers. The
function should display all of the numbers in the list that are
greater than the number n. Output should look like:
Number: 5 List of numbers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] List of numbers that are larger than 5: [6, 7, 8, 9, 10]
Write a C++ code to insert the following numbers in two Linked Lists. Insert numbers of first list in Linked List#1, and numbers of second list in Linked List#2. Do not insert both lists in a single Linked List. List#1. 5, 78, 45, 23, 11, 89, 10, 78, 6, 99, 876, 5, 67, 13 List#2. 5, 89, 688, 52, 557, 953, 5, 7, 55, 35, 89, 99, 99, 6, 557, 89, 5, 99, 6, 2, 45, 12, 7, 6, 94,...
Codio challenge We will pass you 2 inputs an list of numbers a number, N, to look for Your job is to loop through the list and find the number specified in the second input. Output the list element index where you find the number. If N is not found in the list, output -1. Tip: Remember the break statement? It exits the loop. You can (but don’t have to) use this. # Get our input from the command line...
USING SCHEME PROGRAMMING LANGUAGE define a function addSubList that processes a list of lists of numbers and adds up all sub-lists. The output of your function is a flat list of numbers. (You can assume that your function only receives valid input). Example: (define Q '(1 2 (3 4) 1 5 (7 8))) ;;;;;;;;;;;;;;;;;;;;; ; (addSubList Q) ; => '(1 2 7 1 5 15) ;;;;;;;;;;;;;;;;;;;
5. For the following principal quantum numbers list all the orbitals that each contains and specify their l and ml quantum numbers n = 1, n = 2, n = 3, n = 4