karen_constantine

Untitled

Nov 10th, 2023
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. #сокращение дробей
  2. from math import *
  3. def s(a):
  4. b = a.split('/')
  5. c = int(b[0])
  6. d = int(b[1])
  7. e = gcd(c, d)
  8. d1 = c // e
  9. d2 = d // e
  10. d1 = str(d1)
  11. d2 = str(d2)
  12. print(d1 + '/' + d2)
  13. s('3/5')
Advertisement
Add Comment
Please, Sign In to add comment