Question

Python Help Please

Problem 4-4: Make a list of 20 numbers and place them in a random order (dont arrange them in ascending or descending order

0 0
Add a comment Improve this question Transcribed image text
Answer #1

4-6)

Code and output

or main.py 1 list1=[] 2- for i in range(1,100): 3 if ix5==0: 4 list1.append(i) 5 print(list1) input [5, 10, 15, 20, 25, 30, 3

Code for copying

list1=[]
for i in range(1,100):
if i%5==0:
list1.append(i)
print(list1)

==============================

4-6

or 1 main.py list1=[] 2- for i in range(20,31): list1.append(i) 5 print(Normal values = {}:format(list1)) 6- for i in range

Code for copying

list1=[]
for i in range(20,31):
  
list1.append(i)
print("Normal values = {}".format(list1))
for i in range(0,len(list1)):
list1[i]=2*list1[i]
print("Double values = {}".format(list1))   

Add a comment
Know the answer?
Add Answer to:
Python Help Please Problem 4-4: Make a list of 20 numbers and place them in a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please solve this problem using Python Write a quicksort method that accept a list of numbers...

    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.

  • Python please help! Thanks you Write a code to get an unlimited number of grades from...

    Python please help! Thanks you Write a code to get an unlimited number of grades from the user (the user can press enter to finish the grades input, or use a sentinel, for example-1), and then calculate the GPA of all the grades and displays the GPA To do this you might need some help. Try to follow the following process (and check your progress by printing different values to make sure they are as they supposed to be): 1-...

  • Python code You will need to make use of the random library for this homework. It...

    Python code You will need to make use of the random library for this homework. It is pretty simple to use. You can use the following methods: random.choice(list) returns a single item from the list, tuple or string at random. random.sample(list.o - returns a new list of n items randomly chosen from the list, tuple or string random shufflellist)randomly reorders all of the items in the list and changes the list itself. The list must be a mutable object so...

  • Having trouble with python! Write a program to build a list of grades, print them out,...

    Having trouble with python! Write a program to build a list of grades, print them out, add to them and count occurrences, and find the amount of the 2-digit grade values. Here are the criteria a) Your program “L6QI initials.py" must start with a commented ID Box AND include a comment that indicates the e of the program. EACH of the five functions in your program must state its purpose in comments too The main function in your program must...

  • Use Python Spyder to answer: First List – Loop (one that you created in lab 1...

    Use Python Spyder to answer: First List – Loop (one that you created in lab 1 or any new list) • Repeat First List, but this time use a loop to print out each value in the list. First Neat List - Loop • Repeat First Neat List, but this time use a loop to print out your statements. Make sure you are writing the same sentence for all values in your list. Loops are not effective when you are...

  • Help me figure this problem out, please. Use a list to store the players Update the...

    Help me figure this problem out, please. Use a list to store the players Update the program so that it allows you to store the players for the starting lineup. This should include the player’s name, position, at bats, and hits. In addition, the program should calculate the player’s batting average from at bats and hits. Console ================================================================ Baseball Team Manager MENU OPTIONS 1 – Display lineup 2 – Add player 3 – Remove player 4 – Move player 5...

  • I need help in Python. This is a two step problem So I have the code...

    I need help in Python. This is a two step problem So I have the code down, but I am missing some requirements that I am stuck on. Also, I need help verifying the problem is correct.:) 7. Random Number File Writer Write a program that writes a series of random numbers to a file. Each random number should be in the range of 1 through 500. The application should let the user specify how many random numbers the file...

  • 1. Make a function make_list_of_lists(n, m) that creates and returns a list of n lists of...

    1. Make a function make_list_of_lists(n, m) that creates and returns a list of n lists of size m, where each of the m elements in a sublist are randomly generated integers between 1 and 9. For example, you might obtain l = make_list_of_lists(2,2) >>> print(l) [[1, 4], [5, 7]] Big Hint: You can do this using numpy along the lines of the following code: import numpy >>> l = list(numpy.random.randint(a,b,c)) where you need to sort out what the values of...

  • Version:0.9 StartHTML:0000000105 EndHTML:0000008229 StartFragment:0000000141 EndFragment:0000008189 In Python, a tuple is a collection similar to a list...

    Version:0.9 StartHTML:0000000105 EndHTML:0000008229 StartFragment:0000000141 EndFragment:0000008189 In Python, a tuple is a collection similar to a list in that it is an ordered collection of items. An important difference, however, is that a tuple is immutable – once created, a tuple cannot be changed. Also, tuples are denoted using parentheses instead of square brackets. As with lists, elements of a tuple are accessed using indexing notation. For example, given the tuple subjects = (’physics’, ’chemistry’, ’biology’), we could ac cess the...

  • python language Problem Description: In this program we are going to explore a list or an...

    python language Problem Description: In this program we are going to explore a list or an array of integers using Python. Your program should read a set of integers from the user and store them in a list. Read numbers from the user until the user enters 0 to quit. Then store them in a list. Your program should them compute the sum of all the numbers in the list and output to the user. You will use lists and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT