banner

© 2004-21 ict4u.net

Starter Code

The code snippet below is a the beginning of a program to allow the user to enter a series of numbers which are stored in a list.
You have to write the code to find the largest number and print it out.
NOTE:make sure that you are using the correct datatype when you store the data

#Author: Your name here
#Date:
#Purpose: Display the contents of a list  of numbers and the largest number
#set up the initial contents of the list
numberList = []

howMany = int(input("how many numbers will there be in the list"))
for count in range (1, howMany+1):
    newNumber = input("Next number:")     # is this the correct data type?????
    numberList.append(newNumber)

#
#display each item, on one line
print("\nThe list of numbers is:")
for number in numberList:
    print("{}".format(number))
print("\n\n",)
#
# now work out which is the largest number
largestNumber = 0

#
# Your code goes here to work out what the largest number is
## Hint there are functions for:
# count
# sum
# max
# min

print("The largest number is: {}".format(largestNumber))