#Can someone make my code into Html

14 messages · Page 1 of 1 (latest)

fallen arrow
#

def mult(x, y):
return x + y

def sub(x, y):
return x - y

def multiply(x, y):
return x * y

def divide(x, y):
if y == 0:
print("Duch Null ist nicht erlaubt")
else:
return x / y

print("Wähle eine Operation:")
print("1. Addieren")
print("2. Subtrahieren")
print("3. Multiplizieren")
print("4. Teilen")

while True:
choice = input("Gib deine Wahl (1/2/3/4) ein: ")

if choice in ('1', '2', '3','4'):
    num1 = float(input("Gib die erste Zahl ein: "))
    num2 = float(input("Gib die zweite Zahl ein: "))

    if choice == 1:
        print(num1, "+", num2, "=", mult(num1, num2))
    elif choice == '2':
        print(num1, "-", num2, "=", sub(num1, num2))

    elif choice == '3':
        print(num1, "*", num2, "=", multiply(num1, num2))

    elif choice == '4':
        print(num1, "/", num2, "=", divide(num1, num2))
    break
else:
    print("Ungültige Eingabe")
crisp sky
#

Thanks for your question :clap:, if someone gives you an answer it would be great if you thanked them with a :white_check_mark: in response. This response will earn you both points for special roles on this server.

crisp sky
#

Das is python das kann man nich "in html machen"

rare junco
# fallen arrow def mult(x, y): return x + y def sub(x, y): return x - y def multiply(...

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Calculator</title>
<style>

.calculator {
    width: 9999px;
    margin: auto;
    border: 10px solid #000000;
    border-radius: 50px;
    padding: 100px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.calculator input {
    width: 100%;
    margin-bottom: 50px;
    padding: 100px;
    font-size: 106px;
}
#

</style>
</head>
<body>
<div class="calculator">
<input type="text" id="display" disabled>
<button onclick="clearDisplay()">reset</button>
<button onclick="appendToDisplay('1')">1</button>
<button onclick="appendToDisplay('2')">2</button>
<button onclick="appendToDisplay('3')">3</button>
<button onclick="appendToDisplay('4')">4</button>
<button onclick="appendToDisplay('5')">5</button>
<button onclick="appendToDisplay('6')">6</button>
<button onclick="appendToDisplay('7')">7</button>
<button onclick="appendToDisplay('8')">8</button>
<button onclick="appendToDisplay('9')">9</button>
<button onclick="appendToDisplay('+')">+</button>
<button onclick="appendToDisplay('-')">-</button>
<button onclick="appendToDisplay('')"></button>
<button onclick="appendToDisplay('0')">0</button>
<button onclick="appendToDisplay('.')">.</button>
<button onclick="calculate()">=</button>
<button onclick="appendToDisplay('/')">/</button>
</div>

<script>

function appendToDisplay(value) {
    document.getElementById('display').value += value;
}


function clearDisplay() {
    document.getElementById('display').value = '';
}


function calculate() {
    try {
        var result = eval(document.getElementById('display').value);
        document.getElementById('display').value = result;
    } catch (error) {
        document.getElementById('display').value = 'Error';
    }
}

</script>
</body>
</html>

#

it does not look good but ypu can change the way it looks on the code

rare junco
rare junco
crisp sky
rare junco
#

ok

crisp sky
#

🧏🏼‍♂️

rare junco
#

"wähle eine operation" das sagt kein mensch