Crazy

Таблица на квадрати, кубови и корени

Nov 6th, 2018
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. import math
  4.  
  5.  
  6. def makeTable(m, n):
  7.     table = {}
  8.     for i in range(m, n + 1):
  9.         tuple = (int(i**2), int(i**3), round(math.sqrt(i), 16))
  10.         table[i] = tuple
  11.  
  12.     return table
  13.  
  14.  
  15. if __name__ == "__main__":
  16.     m = input()
  17.     n = input()
  18.     x = input()
  19.  
  20.     table = {}
  21.     tuple = ()
  22.  
  23.     if m > n or x < m or x > n:
  24.         print "nema podatoci"
  25.     else:
  26.         tuple = (int(x**2), int(x**3), round(math.sqrt(x), 16))
  27.         print tuple
  28.  
  29.     table = makeTable(m, n)
  30.     print table
Advertisement
Add Comment
Please, Sign In to add comment