Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. def reshima():
  2. list = []
  3. str1 = raw_input("Enter list of strings with spaces between words: ")
  4. list = str1.split()
  5. print 'Your input:', list
  6. bool1 = input('Enter either True or False for Reversed sort: ')
  7. sort1 = sorted(list)
  8. if bool1 == True:
  9. print 'Your new input:', sort1
  10. else:
  11. sort1 = sorted(sort1, reverse=True) # sorted(iterable, key=None, reverse=False)
  12. # variable equal to sorted(variable, and what i want to change in it)
  13. print 'Your new input:', sort1
  14. reshima()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement