Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global num
- global firstrun
- firstrun = 1
- num = 0
- listy = []
- print('Please enter your desired list length.')
- while True:
- try:
- listlength = int(input())
- break
- except ValueError:
- print('Please enter an integer.')
- continue
- while True:
- if firstrun == 1:
- print('Please add a value to the list.')
- firstrun = 0
- else:
- print('Please add another value to the list.')
- currentitem = input()
- listy = listy + [currentitem]
- print()
- if len(listy) > listlength:
- del listy[0]
- else:
- for i in range (0, len(listy)):
- print(listy[i])
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement