![img alttext](myownimg/webdevelopment-security-layout-s.webp)
![img alttext](myownimg/webdevelopment-security-layout-s.webp)
Program-code written in python:
I still need to make a UI, so below the code in front (it works very well on my laptop)
"""Calculate number of liters in cylinder"""
def litersincylinder():
pi = 3.141592653589793
radius = 0
height = 0
while radius == 0:
radius = input("radius in cm.? ")
if radius.isnumeric() == False:
if radius == ("q"):
from sys import exit
exit()
else:
radius = 0
print ("Only numeric values\n")
while height == 0:
height = input("height in cm.? ")
if height.isnumeric() == False:
if height == ("q"):
from sys import exit
exit()
else:
height = 0
print ("Only numeric values\n")
liters = round((((pi*(int(radius))*int(radius))*int(height))/1000), 2)
print ("\n\nNumber of liters: ", liters)
print ("\n")
go_on = ("q")
go_on = input("Any character to continue or \"q\" to quit: ")
print ("\n")
while go_on != ("q"):
if go_on != ("q"):
litersincylinder()
else:
from sys import exit
exit()