+ 2

Program in python add to number 🎯🎯

Python program

6th Aug 2024, 4:11 PM
Deepak Royal Gold 🥇🎯💕
Deepak  Royal Gold 🥇🎯💕 - avatar
4 Answers
+ 1
It seems your question is about adding two numbers together in Python. Here's a simple program to do that_____ # Simple Python program to add two numbers # Take input from the user num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) # Add the two numbers sum = num1 + num2 # Display the sum print("The sum of {0} and {1} is {2}".format(num1, num2, sum)) This program prompts to enter two numbers, adds them together, and then displays the result.
6th Aug 2024, 4:20 PM
✧GHOST✧
✧GHOST✧ - avatar
+ 2
✧GHOST✧ We don't encourage presenting answers for questions, unless they share their attempt.
6th Aug 2024, 6:29 PM
Chris Coder
Chris Coder - avatar
+ 2
✧GHOST✧ , just 3 comments to your sample (this is not a criticism.) > the description of the op according his problem is very vague, and he has not specified what kind of numbers he is going to sum up. so it would be helpful to also mention the use of int numbers. > the variable name `sum` should not be used, since there is a python built-in function with the same name. doing like in your sample, the use of `sum` as a variable name will redefine `sum` as an int object. if the built-in `sum()` is now called in the code, an error will occur: TypeError: 'int' object is not callable > the output of the result is done in an old-style manner. should better be done with an f- string.
6th Aug 2024, 7:18 PM
Lothar
Lothar - avatar
0
Good 😊👍
9th Aug 2024, 11:20 AM
Deepak Royal Gold 🥇🎯💕
Deepak  Royal Gold 🥇🎯💕 - avatar