# python making a list of numbers
i want to use python to make a list of numbers like this
A = [2,2,4,4,6,6,8,8,10,10.....................48,48,50,50]
# it should be a total of 50 numbers long and contain 2 of each even number
#Code.py lst = [] for i in range(2,51,2): lst.append(i) lst.append(i) print(lst)
[2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 26, 26, 28, 28, 30, 30, 32, 32, 34, 34, 36, 36, 38, 38, 40, 40, 42, 42, 44, 44, 46, 46, 48, 48, 50, 50]
# python making a list of numbers i want to use python to make a list...
// use "for i in range():
//use len.
//basic python
//discrete mathematics
Write a program in Python (in a .py file) that: Makes two lists of 50 numbers each, where the first list is multiples of 5, and the second list is the first 50 squares: 1, 4, 9, 16, 25, 36, ....up to 2500. then I want you to make a third list by multiplying each individual pair in the two lists, so for example: 5 times 1 is...
in python I have a list of strings, some contain purely numbers while others are dates, names, etc. I am trying to convert the strings containing only numbers into floats. this is the code I am using but it alwyas returns nothing. Python just says restart and nothing goes through. how can I get my code to do what I want? f = open('GOOG-HistoricalQuotest.txt','r+') ff=f.readlines() clean = [] lst = [] for i in range(2,len(ff)+1): try: [float(i) for i in...
About Python 3 I want to make calculation data saved as array form So I want code like this i=0 while i<10 x=(mean of 20 random sampled numbers) save x to array A i=i+1 print(A) so I expect A=[x1,x2,x3,x4,x5,...,x10] How can I do this?
Assignment: USING PYTHON Expected submission: TWO (2) Python files, main.py and HelperClasses.py Make a file called HelperClasses and create a class inside it called Helpers Inside Helpers, create 8 static methods as follows: 1.) Max, Min, Standard_Deviation, Mean a.) Each of these should take a list as a parameter and return the calculated value 2.) Bubble a.) This should take a list as a parameter and return the sorted list 3.) Median a.) This should take a list as a...
Use Python 3.7 to write the following program: Given a list of n numbers, write a function to shift the numbers circularly by some integer k (k < n). The function should take a list, the amount to shift k, and an argument specifying the direction to shift (left or right). Suggestion: use the % operation and also you need a number between 0 inclusive and the length of the list.
Please solve this problem using Python Write a quicksort method that accept a list of numbers and use list comprehension to construct the method. Note that you need to sort the numbers in descending order . You MUST use List Comprehension to do the sorting Your program should contain the function with format shown as below: def quicksort(a): # Your codes here. Use List Comprehension and return the result.
In Python! Create the program that print out only odd numbers 1,3,5,7,9 Use either a while loop or a for loop to print only odd numbers 1, 3, 5, 7, 9 *tip: you can use range () function, or a condition with ‘break’ (e.g, while count < 10) In python!: Create a program that print out 12 months of a year and associated numbers (e.g., January 1, February 2…). Two lists should be created, and then loop through the list...
Python Help Please
Problem 4-4: Make a list of 20 numbers and place them in a random order (don't arrange them in ascending or descending order - make sure the list is truly random). Calculate and print out the largest number in the list and the lowest number in the list. Problem 4-5: Make a list of multiples of 5 between 1 and 100. Once you have your list, print it out. Problem 4-6: Generate a list of values from...
I want to write a python function to find the minimum I have an nested list: list = [[0,2,3], [1,6],[4,7]] I want to find out in minimum of each list and compare between each other then return the final minimum result for example: above the nested_list [[0,2,3], [1,6],[4,7,11]], for each set of the list the minimum would be [1,5,3] -> final return would be [1]
I want solve it
Question (4): (5 marks) Write a Python program to print all even numbers in given list. Example: Input: list_1 = (2, 4, 5, 7, 13, 44, 45] Output: [2, 4,44]