Information, calcul, communication
CS-119(k)
ICC-P Code pour exercice 5
This page is part of the content downloaded from ICC-P Code pour exercice 5 on Sunday, 29 June 2025, 20:43. Note that some content and any files larger than 50 MB are not downloaded.
Page content
Code:
should_continue: bool = True
while should_continue:
print("Je vais évaluer un calcul pour vous.")
number1_string: str = input("Tapez le premier nombre: ")
number1: float = float(number1_string)
number2_string: str = input("Tapez le second nombre: ")
number2: float = float(number2_string)
operation: str = input("Tapez l'opération: ")
if operation == "+":
result = number1 + number2
print(f"{number1} + {number2} = {result}")
else:
print(f"Désolé, je ne connais pas l’opération '{operation}'")
maybe_quit: str = input("Tapez 'q' pour quitter, ou autre chose pour recommencer: ")
if maybe_quit == "q":
print("Bye!")
should_continue = False