Advertisement
davidgaf

Division Times

Dec 4th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. tc = 382
  2. num_intera = 0
  3. offset = 100
  4. rest = tc % offset
  5.  
  6. if (rest>0):
  7.     num_intera = (tc // offset) + 1
  8.     print(num_intera)
  9. else:
  10.     print(tc // offset)
  11.  
  12. # Operador Ternário - Python função
  13.  
  14. def verificaDivisoes(rest=0, offset=100, tc=0):
  15.     rest = tc % offset
  16.     return (tc // offset)+1 if rest > 0 else tc // offset  
  17.  
  18. print(verificaDivisoes(tc=tc))
  19.  
  20. for i in range(1, verificaDivisoes(tc=tc)+1):
  21.     print(offset*i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement