Beispiel #1
0
def main() -> None:
    weight = 0
    height = 0

    while True:
        weight = input("Wat is uw gewicht (in kilogram)?\n")
        weight = weight.replace(",", ".")

        if (CheckInput.is_numeric(weight) or CheckInput.is_float(weight)) and CheckInput.is_positive(weight):
            break
        else:
            print("Dat is geen geldige invoer, probeer opnieuw!")
            continue

    while True:
        height = input("Wat is uw lengte (in centimeter)?\n")
        height = height.replace(",", ".")

        if CheckInput.is_numeric(height) and CheckInput.is_positive(height) and 2 <= len(height) <= 3:
            height = float(height) / 100
            break
        else:
            print("Dat is geen geldige invoer, probeer opnieuw!")
            continue

    bmi = calculate_bmi(weight, height)
    print("Uw BMI is: {0} u hebt {1}".format(str("{0:.2f}".format(bmi)).replace('.', ','), str(BmiEnum(health(bmi)))))
Beispiel #2
0
from Modules import CheckInput

__author__ = 'Owain'


def convert_to_miles(val):
    return float(val) * 0.6214

digit = 0

while True:
    digit = input("Voer een getal in:\n")

    if CheckInput.is_float(digit):
        if CheckInput.is_positive(digit):
            break
        else:
            print("Dat is geen positief getal, probeer opnieuw!")
            continue
    else:
        print("Dat is geen geldig getal, probeer opnieuw!")
        continue

print(convert_to_miles(digit))

# Line: A sequence of zero or more non- <newline> characters plus a terminating <newline> character.