self caps value at initialization and at every operation
todo: implement other builtin methods (only abs() for now)
test log for Int operations while capping value
src
transpiled
output
test log for Int Float assignment and val capping
src
transpiled
def main():
_num: Float = Float(input(String("Enter number to be squared: ")))
_times: Int = Int(Float(input(String("Enter number of times to square: "))))
if (_num > 0):
_i: Int = Int(Float(0))
while (_i < _times):
print(_num)
_num = Float(_square(_num))
_i = (_i + 1)
else:
print(String(f"Enter a positive number. '{_num}' is not a positive number."))
def _square(_num: Float):
_num: Float = Float(_num)
return (_num * _num)
if __name__ == '__main__':
# clear screen before executing
import platform
import os
os.system('cls' if platform.system() == 'Windows' else 'clear')
# declare globals
main()
closes #241
builtin
Int
andFloat
typestodo: implement other builtin methods (only
abs()
for now)test log for Int operations while capping value
src
transpiled
output
test log for Int Float assignment and val capping
src
transpiled
output