ok this is my last one and i am still a total n00b to this.
this is my assigment:

Lab: Finding the largest number

In this lab, you will write a program that finds the largest number of a sequence. First, your program asks the user to enter an integer number. Then the program creates a sequence of random integers that are less than 10 and outputs the largest number in the sequence. The number entered by the user determines the size of the sequence. For example, if the user enters 6, then the sequence should have 6 random integers.

Here’s an example of a run of the program. The output from the program is in blue, and the input (what you type) is in black.

please enter an integer: 0
This is not an integer greater than 0.
please enter an integer: a
This is not an integer greater than 0.
please enter an integer: 6

The random sequence is [1, 8, 7, 2, 4, 4]

The largest number in the sequence is 8

press enter to exit:

1. Coding the assignment
Open the python IDLE GUI. Similar to lab 6, you will be using raw_input function to get the user input, and printing out the final “Press enter to exist:” message. There is more than one way to do this lab, so we will not give step-by-step instructions. Some hints and requirements are:

· Your program should first import the random module. Right after that, you must put in this line of code (in red):
random.seed(1)
· You must check the input is actually an integer greater than 0. It cannot be 0 or any character. You can do this by using a while loop to keep asking the user until he/she enters the correct input.
· Once you get the input, you may use the randrange() function in the random module to generate an integer. How do you use randrange()? You do the following:
random.randrange(10)
This will randomly generate an integer number less than 10.
· To fill your sequence with the amount of integer specified by the user, you may use a for loop. Inside the for loop, you should call randrange to generate a random number and add that to your sequence.
· To find the largest number, you may use a for loop to go through each number in your sequence and determine which one is the largest.

i have something like this so far:

import random
random.seed(1)
In = raw_input("Please Enter An Integer:")


while In == 0 and string:
print "Please Enter An Integer Greater Than 0"

else:


random(In) = lister

for i in lister:
sort.list()
print lister

someone want to kick me in the right direction?

ok i got the code i am only missing one thing..

how do i make sure that when the user inputs a character that i can print "please enter a integer"
__________________

You can loop your input until the conditions are met:

while True:
    s = raw_input("Please enter an integer: ")
    try:
        n = int(s)
        if n > 0:
            break
        else:
            print "This is not an integer greater than 0"
    except ValueError:
        pass

print n  # test
This article has been dead for over six months. Start a new discussion instead.