Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- numbers = [random.randint(0, 1000) for n in range(2, random.randint(3, 50))]
- #this
- for num in numbers:
- for othernum in numbers:
- if othernum != num:
- lessOrMore = "less" if num < othernum else "more"
- print("{} is {} than {}".format(num, lessOrMore, othernum))
- #or this
- 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