What is an assignment operator? How is it different from input () function?
Answers
Answer:
Assignment Operators are the operators which is used in calculation purpose, but it is different from the arithmetic operators. This is because in arithmetic operators simply find the value of C by adding the value of A + B. In case of Assignment operators, find the value of C by adding C + A only using this operator ( += ).
Explanation:
Assignment operator is a type of operator which perform some function by taking data from user as a input. These assignments operators are :
- ( = ) → C = A + B
- ( += ) → C += A = C = C + A
- ( - = ) → C - = A = C = C - A
- ( *= ) → C *= A = C = C * A
- ( /= ) → C /= A = C = C / A
These are the following instructions which we use in assignment operator to operate these functions by taking input or values from user.
Just like if you want to perform the fourth function that is (*=). Firstly, computer take this function and use like this:
If a person wants to use this operator called (*=) then they need two value which they input to get the output from the computer.
So, a = 3 and b = 4
=> By using (*=) operator
=> a = a*b
=> a = 12
So, they get the result as 12.
Now, input() function is used to take input from the user but assignment operator is use to do the assignment given by user.
There are two words in which many people gets confused so I want to explain these two words are as follows as:
- Operands : These are the numbers or values in which we use operators for calculation purpose.
- Operators : These are the signs which we use in operands to solve or calculate any two or more operands.
Learn more from this link here:
https://brainly.in/question/2804107