Basic computation in python

Veröffentlicht am: 17 Februar 2025
auf dem Kanal: Edmoss
17
1

Basic Computation in Python: Addition of Two Numbers

In Python, basic arithmetic operations can be performed using simple input and output functions. The following code demonstrates how to take two numbers as user input, perform an addition operation, and display the result:

```python
num1 = int(input("Enter Num1: "))
num2 = int(input("Enter Num2: "))
ans = num1 + num2
print("The sum is:", ans)
```

#Explanation
1. The `input()` function is used to take user input as a string.
2. `int()` converts the input string into an integer.
3. The `+` operator performs the addition of `num1` and `num2`.
4. The `print()` function displays the computed sum.

This basic computation approach is useful for simple mathematical operations and serves as an introduction to handling user input and performing calculations in Python.


Auf dieser Seite können Sie das Online-Video Basic computation in python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Edmoss 17 Februar 2025 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 17 Mal angesehen und es wurde von 1 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!