Exercise 2
Write a program in Python that asks the user to enter two numbers 'a' and 'b' and display their sum: 'a + b'
Solution
|
1 2 3 4 5 6 7 8 9 |
# coding: utf-8 # ask the user to enter the values of a and b a = input("Type the value of number a: ") b = input("Type the value of number b: ") # Convert strings to integer a = int(a) b = int(b) s = a+b print("The sum of a and b is a + b = ", s) |
Younes Derfoufi
CRMEF OUJDA
Acheter sur Très Facile !
-

Hub USB 3.0 OBERSTER Multiport
€ 7,00 Acheter le produit -
Promo !

Routeur WiFi AX 3000 Mbps TP-Link Routeur, WiFi 6, 4 antennes à haute performance, OneMesh, WPA3
Le prix initial était : € 99,00.€ 56,00Le prix actuel est : € 56,00. Acheter le produit -

POO: Cours et exercices en UML2, Python, PHP, C#, C++ et Java (French Edition)
€ 17,00 Achetez le livre
1 thought on “Solution Exercise 2: python program that displays the sum of two numbers”