Advertisement
JovanPapi

[SNZ - lab1] Tablica na kvadrati, kubovi i koreni

Nov 1st, 2019
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. import math
  2.  
  3. if __name__ == "__main__":
  4.     start_number = int(input())
  5.     end_number = int(input())
  6.     check_key = int(input())
  7.     book = {}
  8.     while start_number <= end_number:
  9.         # first we do the operations with the number and put those in tuple
  10.         aux_tuple = (start_number ** 2, start_number ** 3, math.sqrt(start_number))
  11.  
  12.         # then we add the tuple in the book with a key start_number, and increment the key for 1
  13.         book[start_number] = aux_tuple
  14.         start_number = start_number + 1
  15.  
  16.     # reverse logic, if book.keys() doesnt contain check_key print .....
  17.     if check_key not in book.keys():
  18.         print("nema podatoci")
  19.     else:
  20.         print(book[check_key])
  21.  
  22.     print(book)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement