Write a program in Python to explain assignment operators
Answers
A Program in Python to explain the assignment operators are as follows:
#!/usr/bin/python
x = 10
y = 20
z = 30
z = x + y
print "The new Value of z is ", z
z *= x
print "The new Value of z is ", z
z /= x
print "The new Value of z is ", z
z = y - x
print "The new Value of z is ", z
Explanation:
- Python is a programming language that supports various types of assignment operators such as ADD(+), subtract(-),multiply(*),division(/),modulus(%) etc.
- Above example includes the assignment operators.
Learn more about Python
Write any two features of python that make it user friendly
brainly.in/question/9677174
In how many different ways, can you work in python?
brainly.in/question/9479066
print("This program will show you what assignment operators are.")
a = int(input("Enter a value:"))
b = int(input("Enter a value:"))
c = int(input("Enter a value:"))
print("Let's add the values to a variable 'd'.")
d = a + b + c
print("The value of 'd' is now", d)
print("Now, coming to the operators.")
print("d += a + b")
print("What happens here is, the value of d + a + b is assigned to 'd'.")
d += a + b
print("The new value of 'd' is", d)
print("c *= d + a + b")
print("Here, the value of c*d + a + b is assigned to 'c'.")
c *= d + a + b
print("The new value of 'c' is", c)
print("d -= b")
print("Here, the value of d - b is assigned to 'd'.")
d -= b
print("The new value of 'd' is", d)
print("a /= c + d")
print("Here, the value of a/c + d is assigned to 'a'.")
a /= c + d
print("The new value of 'a' is", a)