Jul-13-2019, 08:48 PM
First, I'm not sure what's so hard about
numbers = [0] * 4
. That seems like an easy way to initialize a list to zeros. Second of all, you don't need to do that, since you are overwriting all the values anyway. In Python, lists do not have a set size, their size can change. The Pythonic way to get a list of four integers from the user is:numbers = [] for number in range(4): numbers.append(int(input('Enter a value for the list: '))) print('\nHere are the values you entered: {}.'.format(', '.join(str(number) for number in numbers)))
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures