-
Notifications
You must be signed in to change notification settings - Fork 1
01‐Basics‐Add.py
SunilOS edited this page Sep 11, 2024
·
1 revision
Here's a breakdown and explanation of the Python program:
a = 10
b = 20
c = 0
c = a + b
print("Add = ", c)-
Variable Assignment:
-
a = 10: The variableais assigned the value10. -
b = 20: The variablebis assigned the value20. -
c = 0: Initially, the variablecis assigned the value0.
-
-
Addition Operation:
-
c = a + b: This line performs the addition of the variablesaandb, which is10 + 20. The result,30, is then assigned to the variablec.
-
-
Output:
-
print("Add = ", c): This line prints the message"Add = "followed by the value ofc, which is30.
-
The output of this program will be:
Add = 30
-
Variable assignment: Variables store data values. Here,
a,b, andcare integer variables. -
Operators: The
+operator is used to add the values ofaandb. -
Print statement: The
print()function outputs text to the console.
This is a basic Python program demonstrating how to assign variables, perform arithmetic operations, and print the result to the console.