Advertisement
Guest User

Untitled

a guest
Jul 16th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. global num
  2. global firstrun
  3.  
  4. firstrun = 1
  5.  
  6. num = 0
  7. listy = []
  8.  
  9. print('Please enter your desired list length.')
  10.  
  11. while True:
  12. try:
  13. listlength = int(input())
  14. break
  15. except ValueError:
  16. print('Please enter an integer.')
  17. continue
  18.  
  19. while True:
  20. if firstrun == 1:
  21. print('Please add a value to the list.')
  22. firstrun = 0
  23. else:
  24. print('Please add another value to the list.')
  25.  
  26. currentitem = input()
  27. listy = listy + [currentitem]
  28. print()
  29.  
  30. if len(listy) > listlength:
  31. del listy[0]
  32. else:
  33. for i in range (0, len(listy)):
  34. print(listy[i])
  35.  
  36. print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement