Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def gen_seq():
- a, b, c = 0, 0, 0
- while True:
- a = random.randint(1, 100)
- b = random.randint(1, 100)
- c = random.randint(1, 100)
- if a < b and b < c:
- if b-a == c-b:
- return [(a, b, c), b-a]
- for _ in range(10):
- print(gen_seq())
Advertisement
Comments
-
- #Program ma wylosować trzy liczby całkowite do zmiennych a, b oraz c z przedziału <-20, 200>.
- #Losowanie trwa do momentu w którym zmienne a, b, c w podanej kolejności tworzą ciąg rosnący arytmetyczny.
Add Comment
Please, Sign In to add comment
Advertisement