Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. number = 0
  2. y = 0
  3. sortlist = [10, 12, 14, 16, 18, 20, 22, 24, 40]
  4. sortlist2 = []
  5. def inputnmbrs():
  6. print("input")
  7. def select(values):
  8. #("Okay, let's select sort! Please enter numbers, one by one. When you have finished inputting numbers, please enter [X]")
  9. print("Do you want it to sort in ascending or descending order...or do you want to input?[ascend][descend][input]")
  10. selectchoice = input()
  11. if selectchoice == "descend":
  12. values.remove(max(values))
  13. sortlist2.append(max(values))
  14. for i in range(y, len(values) - 1):
  15. values.remove(max(values))
  16. sortlist2.append(max(values))
  17. print(sortlist2)
  18. print(sortlist2)
  19. elif selectchoice == "ascend":
  20. for i in range(y, len(values) - 1):
  21. values.remove(min(values))
  22. sortlist2.append(min(values))
  23. print(sortlist2)
  24. elif selectchoice == "input":
  25. def inputselect(Inputnumbers):
  26. print("input your numbers")
  27. Inputnumbers = input("input numbers separated by a comma: ")
  28. separatedselect = Inputnumbers.split(" , ")
  29. for i in range(y, len(separatedselect)):
  30. separatedselect.remove(min(separatedselect))
  31. sortlist2.append(min(separatedselect))
  32. print(sortlist2)
  33. def integrate():
  34. print("integrate")
  35. def bubble():
  36. print("bubble")
  37.  
  38. print("Hey, welcome to my sorting algorithm!")
  39. print("What sort would you like me to do? [select], [integrate], [bubble], or would you like to input your own numbers [numbers]?")
  40. sortchoice = input()
  41. if sortchoice.lower() == "select":
  42. select(sortlist)
  43.  
  44. elif sortchoice.lower() == "integrate":
  45. integrate()
  46. elif sortchoice.lower() == "bubble":
  47. bubble()
  48. elif sortchoice.lower() == "numbers":
  49. inputnmbrs()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement