Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- spam=[]
- def comma_code(spam):
- return 'spam[:-1]'+' and'+' spam[-1]'
- while True:
- print('Please enter a list of at least two items.'+' (Or enter nothing to stop.):')
- item=input()
- if int(len(spam))< 2:
- print('Your list is too short.')
- if int(len(spam))>= 2:
- print('You have entered a valid list.')
- else:
- break
- spam=spam+ [item] # list concatenation
- comma_code(spam)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement