I have the following code:
print('Phase 1: Gather user input')
print('--------------------------')
# function to verify the user entered an integer greater than 0
def verifyPositve(x):
try:
return int(x) >= 0
except ValueError:
return False
print('Please enter integer values, as error-checking has not yet been implemented.')
while True:
x = input('Enter a positive number: ')
if verifyPositve(x) == True:
numList.append(x)
elif x == 'done':
break
else:
print('You did not pick a positive number.')
print('Numbers entered: %s' % (numList))
On the final print statement, I am attempting to include the numbers from the list without the braces or commas.
I found this solution on Stackoverflow but I can't figure out how to implement it in the same line as "Numbers entered:".
I just keep finding the same solution in searches. Any suggestions or links to a reference on how to solve this?
Thank you for your time.
EDIT: This has been solved in the comments with the following code:
print('Numbers entered: %s' % ', '.join(numList)))
Not sure how to close it or if I just leave it open.
Thank you all.