Google News
logo
Python Program to Assignment Operator
In Python, the assignment operator `=` is used to assign a value to a variable. Here's an example program :
Program :
# assign a value to a variable
x = 5

# print the value of the variable
print(x)

# assign a new value to the variable
x = 10

# print the new value of the variable
print(x)
Output :
5
10
In this program, the value 5 is assigned to the variable `x` using the assignment operator. The value of `x` is then printed to the console. Next, a new value of 10 is assigned to `x` using the assignment operator, and the new value of `x` is printed to the console.