Guest User

Untitled

a guest
May 24th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import random
  2.  
  3. numbers = [random.randint(0, 1000) for n in range(2, random.randint(3, 50))]
  4.  
  5. #this
  6. for num in numbers:
  7. for othernum in numbers:
  8. if othernum != num:
  9. lessOrMore = "less" if num < othernum else "more"
  10. print("{} is {} than {}".format(num, lessOrMore, othernum))
  11.  
  12.  
  13. #or this
  14. print('\n'.join("{} is {} than {}".format(n, "less" if n<n2 else "more", n2) for n, n2 in zip(numbers,reversed(numbers)) if n!=n2))
Add Comment
Please, Sign In to add comment