# Help with a List Program

Page 1 of 1

## 11 Replies - 362 Views - Last Post: 27 October 2017 - 09:10 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=407208&amp;s=1cbcba3e41f084220039863c7be68a14&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 desolatewonders

Reputation: 0
• Posts: 5
• Joined: 27-October 17

# Help with a List Program

Posted 27 October 2017 - 02:48 AM

need help with this code in python 2.7 as show below. I am a new programmer so all of this is fairly new and frustrating to me.
Your task in this programming assignment is to write a Python program that generates a list of integers, such that both its length and the integers added to the list are provided by the user. Subsequently, display the list, followed by information about the list. Here's output of a sample run (user input is shown in bold red):
How many integers would you like to add to the list? 7
Enter an integer: 54
Enter an integer: 91
Enter an integer: 23
Enter an integer: 8
Enter an integer: -66
Enter an integer: 39
Enter an integer: 2
The original list: [54, 91, 23, 8, -66, 39, 2]
The length of the list is 7.
The minimum value in the list is -66.
The maximum value in the list is 91.
The sorted list: [-66, 2, 8, 23, 39, 54, 91]
The reverse sorted list: [91, 54, 39, 23, 8, 2, -66]
To help clarify, here are some specifics and/or constraints: (1) Generating the list (including its length) must be done in a function that is called from the main part of the program (see the template for more details); (2) You must use the list functions discussed in class to add integers to the list and to display information about the list (i.e., its length, the minimum and maximum values in the list, sorting the list, and reverse sorting the list); (3) You must use the provided source code template; and (4) You must submit your source code as a single .py file.
This was an example. If you could help a new programmer out, that'd be awesome!! Also, I am not asking anyone to do the whole problem for me but for them to help define functions and what i can and cant use. Thanks!

Is This A Good Question/Topic? 0

## Replies To: Help with a List Program

### #2 andrewsw

• blow up my boots

Reputation: 6447
• Posts: 26,074
• Joined: 12-December 12

## Re: Help with a List Program

Posted 27 October 2017 - 03:22 AM

What have you thought about or considered?

(Presumably you've attended some classes so the assignment isn't a complete mystery to you?)

### #3 desolatewonders

Reputation: 0
• Posts: 5
• Joined: 27-October 17

## Re: Help with a List Program

Posted 27 October 2017 - 03:26 AM

andrewsw, on 27 October 2017 - 03:22 AM, said:

What have you thought about or considered?

(Presumably you've attended some classes so the assignment isn't a complete mystery to you?)

i know i have to add while functions and append the list with the integer put in, its just im not quite sure how to do it

### #4 andrewsw

• blow up my boots

Reputation: 6447
• Posts: 26,074
• Joined: 12-December 12

## Re: Help with a List Program

Posted 27 October 2017 - 03:51 AM

So, you've attended some classes?

If you are completely lost then you should speak to your tutor. Otherwise, we need to see some demonstration of initial effort from yourself. We won't guide you without some effort shown.

### #5 desolatewonders

Reputation: 0
• Posts: 5
• Joined: 27-October 17

## Re: Help with a List Program

Posted 27 October 2017 - 03:59 AM

andrewsw, on 27 October 2017 - 03:51 AM, said:

So, you've attended some classes?

If you are completely lost then you should speak to your tutor. Otherwise, we need to see some demonstration of initial effort from yourself. We won't guide you without some effort shown.

ive seen multiple tutors but they arent very helpful. Ive plugged in muliple things and just get errors

desolatewonders, on 27 October 2017 - 03:58 AM, said:

andrewsw, on 27 October 2017 - 03:51 AM, said:

So, you've attended some classes?

If you are completely lost then you should speak to your tutor. Otherwise, we need to see some demonstration of initial effort from yourself. We won't guide you without some effort shown.

ive seen multiple tutors but they arent very helpful. Ive plugged in muliple things and just get errors

again im not sure if this is right or not, or if im in the ballpark

my_list = []

for i in range(5):
my_list.append(int(input()))

print(my_list)

### #6 andrewsw

• blow up my boots

Reputation: 6447
• Posts: 26,074
• Joined: 12-December 12

## Re: Help with a List Program

Posted 27 October 2017 - 04:13 AM

You are trying to do everything at once. Break it down into steps.

Quote

write a Python program that generates a list of integers, such that both its length and the integers added to the list are provided by the user.
... Here's output of a sample run (user input is shown in bold red):
How many integers would you like to add to the list? 7

You will ask the user "how many integers...". How can you ask this question and store their response? When they type "7", for example, how will you store this?

### #7 DK3250

• Pythonian

Reputation: 337
• Posts: 1,130
• Joined: 27-December 13

## Re: Help with a List Program

Posted 27 October 2017 - 04:13 AM

Remember to place code between code tags (found right above the input window).
```my_list = []

for i in range(5):
my_list.append(int(input()))

print(my_list)
```

This is your code, - does it work?
If yes, you are now in progress; what is the question here?

### #8 andrewsw

• blow up my boots

Reputation: 6447
• Posts: 26,074
• Joined: 12-December 12

## Re: Help with a List Program

Posted 27 October 2017 - 04:13 AM

It is also important on this forum with Python code that you wrap it in code tags. Look in the box where you type a post, it shows there how to do this.

### #9 desolatewonders

Reputation: 0
• Posts: 5
• Joined: 27-October 17

## Re: Help with a List Program

Posted 27 October 2017 - 04:22 AM

i think i have it down, but i need help with adding the input questions such as "enter an integer"

### #10 desolatewonders

Reputation: 0
• Posts: 5
• Joined: 27-October 17

## Re: Help with a List Program

Posted 27 October 2017 - 04:29 AM

andrewsw, on 27 October 2017 - 04:13 AM, said:

It is also important on this forum with Python code that you wrap it in code tags. Look in the box where you type a post, it shows there how to do this.

or entering a specific ammount

### #11 andrewsw

• blow up my boots

Reputation: 6447
• Posts: 26,074
• Joined: 12-December 12

## Re: Help with a List Program

Posted 27 October 2017 - 04:50 AM

You could have a look at the docs for input(), but presumably you examined this function in class and have some reading/reference material?

How many classes did you attend?
What did they cover in the classes?
What course materials do you have?

### #12 albert003

• D.I.C Regular

Reputation: 14
• Posts: 411
• Joined: 15-December 14

## Re: Help with a List Program

Posted 27 October 2017 - 09:10 PM

We're not here to do your homework. If the class gave you homework, then the homework they assigned you would be on topics you covered in class like andrewsw said.