Advertisement
Guest User

Untitled

a guest
Aug 27th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. def main():
  2.  
  3. #get the integers
  4. high = int(input('Enter the high integer for the range '))
  5. low = int(input('Enter the low integer for the range '))
  6. multi = int(input('Enter the integer for the multiples '))
  7.  
  8. #call the function
  9. multiples = show_multiples(low, high, multi)
  10.  
  11. #print the multipes
  12. print(multiples)
  13.  
  14. #take the arguments into the function
  15. def show_multiples(low, high, multi):
  16.  
  17. #set counter
  18. counter = 0
  19.  
  20. #create list
  21. results = []
  22.  
  23. #set loop
  24. keepgoing = True
  25.  
  26. while keepgoing == True:
  27.  
  28. #add to counter each pass
  29. counter += 1
  30.  
  31. #math to get multiples
  32. result = multi * counter
  33.  
  34. #high side stop
  35. if result >= high:
  36.  
  37. keepgoing = False
  38. #cut the list and sort it
  39. results[low:high]
  40. results.sort(reverse=True)
  41.  
  42. else:
  43. keepgoing = True
  44.  
  45. return (result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement