Skip to content

Latest commit

 

History

History
62 lines (61 loc) · 1.07 KB

12. Unit 1 - Lesson 12.md

File metadata and controls

62 lines (61 loc) · 1.07 KB

Identity Operators

Q1. 3
Q2.

x=int(input("Enter an integer: "))
y=int(input("Enter the same integer: "))
print("x is y",x is y)
print("x is not y",x is not y)
x=float(input("Enter a Float Number: "))
y=float(input('Enter the same Number: '))
print("x is y",x is y)
print("x is not y",x is not y)

Q3.

x=int(input("x: "))
y=int(input("y: "))
print(x,"is",y,x is y)

Q4.

x=int(input("x: "))
y=int(input("y: "))
print(x,"is not",y,x is not y)

Operators Precedence

Q1. 1,2
Q2. Next
Q3.

a=int(input("a: "))
b=int(input("b: "))
print(a,"+",b,"*","5 =",a+b*5)
print(a,"+",b,"*","6 / 2 =",a+b*6/2)

Q4.

a=int(input("a: "))
b=int(input("b: "))
print(a,"+",b,"* 5 =",a+b*5)
print(a,"+",b,"* 5 * 10 / 2 =",a+b*5*10/2)

Q5.

a=int(input("a: "))
b=int(input("b: "))
c=int(input("c: "))
print("a and b or c",a and b or c)
print("a or b and c",a or b and c)

Q6.

a=int(input("a: "))
b=int(input("b: "))
c=int(input("c: "))
print(a,"and",b,"and",c,"or",a,"is",a and b and c or a)
print(a,"or",b,"and",c,"and",a,"is",a or b and c and a)