SHARE
TWEET

Untitled

a guest May 19th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2. pocet = 0
  3.     for i in range(100):
  4.         num1 = random.randrange(99)
  5.         num2 = random.randrange(99)
  6.  
  7.         if random.randrange(2) == 1:
  8.             sign = "-"
  9.         else:
  10.             sign = "+"
  11.  
  12.         if sign == "+":
  13.             if (num1 + num2) < 100:
  14.                 i += 1
  15.                 print(num1, "+", num2, "=")
  16.             else:
  17.                 continue
  18.         if sign == "-":
  19.             if (num1 - num2) < 100:
  20.                 i += 1
  21.                 print(num1, "-", num2, "=")
  22.             else:
  23.                 continue
  24.  
  25. subor = open("subor.txt", 'w')
  26. for riadok in subor:
  27.     subor.writeline(priklady())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top