# Program to demonstrate conditional operator a, b = , # Copy value of a in min if a < b else copy b min = a if a < b else b print ("The Minimum of A and B is ",min) # End of the Program Output: The Minimum of A and B is Program . To test Conditional (Ternary) Operator : . . Delimiters Delimiters are sequence of one or more characters used to specify the boundary between seperate, independent regions in plain text or other data streams.
Python uses the symbols and symbol combinations as delimiters in expressions, lists, dictionaries and strings. Following are the delimiters. ( ) [ ] { } , : . ‘ = ; .
. Literals Literal is a raw data given to a variable or constant. In Python, there are various types of literals. ) Numeric ) String ) Boolean (i) Numeric Literals Numeric Literals consists of digits and are immutable (unchangeable).
Numeric literals can belong to different numerical types Integer, Float and Complex. 12th Computer Chapter - - # Program to demonstrate Numeric Literals a = 0b1010 #Binary Literals b = #Decimal Literal c = 0o310 #Octal Literal d = 0x12c #Hexadecimal Literal print ("Integer Literals :",a,b,c,d) #Float Literal = . = .5e2 print ("Float Literals :", , ) #Complex Literal x = + . j print ("Complex Literals :") Print ("x = ", x , "Imaginary part of x = ", x.imag, "Real part of x = ", x.real) #End of the Program Output: Integer Literals : Float Literals : .
. Complex Literals : x = ( + .14j) Imaginary part of x = . Real part of x = . Program .
: To demonstrate Numeric literals (ii) String Literals In Python a string literal is a sequence of characters surrounded by quotes. Python supports single, double and triple quotes for a string. A character literal is a single character surrounded by single or double quotes. The value with triple-quote "' '" is used to give multi-