1. Mention the use of //.**,% operator in python Ans : // this operator is used to do floor division ** this operator is used to do Exponet % this operator is used to do Modules 2. Describe the ternary operator in Python Ans Ternary operator is used to test a condition and then assign the corresponding value to a variable or execute a peice of code Syntax: [on true] if [expression] else [on false] 3. Describe about different Logical operators in Python with appropriate examples Ans Logical Operators are used in making Decession and : if both experssion are true it returns true else false or : if one expression is true it returns true else false not : it reverses the expression Program: a = int(input("Enter any Number")) if (a%4==0 and a%100!=0 or a%400==0): print(a, " is a leap year") else: print(a,"is not a leap year") 4. Describe about different Arithmetic operators in Python with appropriate examples. Ans: Arithmetic operators are used to perfo...
Comments
Post a Comment