📖 generic · 12th TN - English Medium · COMPUTER SCIENCE · Page 53question

PYTHON – VARIABLES AND OPERATORS · Part 8

Chapter 2: 3 · COMPUTER SCIENCE

-= Subtracted and assign back the result to left operand >>> x-= # x=x- *= Multiplied and assign back the result to left operand >>> x*= # x=x* /= Divided and assign back the result to left operand >>> x/= # x=x/ 12th Computer Chapter - - %= Taken modulus(Remainder) using two operands and assign the result to left operand >>> x%= # x=x% **= Performed exponential (power) calculation on operators and assign value to the left operand >>> x**= # x=x** //= Performed floor division on operators and assign value to the left operand >>> x//= Program . To test Assignment Operators: Program Coding Output #Demo Program to test Assignment Operators x=int (input("Type a Value for X : ")) print ("X = ",x) print ("The x is =",x) x+= print ("The x += is =",x) x-= print ("The x -= is = ",x) x*= print ("The x *= is = ",x) x/= print ("The x /= is = ",x) x%= print ("The x %= is = ",x) x**= print ("The x **= is = ",x) x//= print ("The x //= is = ",x) #Program End Type a Value for X : X = The x is = The x += is = The x -= is = The x *= is = The x /= is = . The x %= is = . The x **= is = .

The x //= is = . (v) Conditional operator Ternary operator is also known as conditional operator that evaluate something based on a condition being true or false. It simply allows testing a condition in a single line replacing the multiline if-else making the code compact. 12th Computer Chapter - - Python – Variables and Operators The Syntax conditional operator is, Variable Name = [ ] if [Test expression] else [ ] Example : min= if < else # min = min= if > else # min =

Related topics

Have a question about this topic?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →