I am working on a homework assignment for introductory Python, so I don't want an outright answer, just clarification. My question states to implement a function to ask the user for a list of numbers, then to check if the number is greater than another value and if so, to write those values to a file. I believe what I have written is correct but I am unsure how to check it. Below is the code I have written:
def numberLogger (filename,minval):
'ask the user to enter a list of numbers. If a number is greater than or equal to the second paramter, append it to a file'
userdata=input('Enter a series of numbers seperated by a comma: ')
u=userdata.split(',')
for i in u:
i=int(i)
if i>=minval:
infile=open(filename,'w')
infile.write(i)
infile.close()
Any help is much appreciated, as I said, it is homework so please don't just give away the answer, rather guide me to it.