Level 1

1.

Take two inputs from user and check whether they are equal or not.

Answer

```
print "Enter first number"
first = input()
print "Enter second number"
second = input()
print first == second
```

2.

Take 3 inputs from user and check :

all are equal

any of two are equal

( use**and ****or** )

all are equal

any of two are equal

( use

Answer

```
print "first number"
first = input()
print "second number"
second = input()
print "third number"
third = input()
all = first == second and second == third and third == first
print "All are equal:",all
any = first == second or second == third or third == first
print "Any of three are equal:",any
```

3.

Take two number and check whether the sum is greater than 5, less than 5 or equal to 5.

Answer

```
print "Enter first number"
first = input()
print "Enter second number"
second = input()
sum = first+second
print "Sum is greater than 5:",sum>5
print "Sum is equal to 5:",sum==5
print "Sum is lesser than 5:",sum<5
```

4.

Judge the follwing expressions :

not(True and True)

True or False

not(False and True)

False and False

not(True and True)

True or False

not(False and True)

False and False

Answer

```
print not(True and True)
print True or True
print not(False and False)
print False and False
```

5.

Suppose passing marks of a subject is 35. Take input of marks from user and check whether it is greater than passing marks or not.

Answer

```
pm = 35
marks = input()
print "Marks is greater than passing marks:", marks>pm
```

Recent Posts

7 Critical Tips to Learn Programming Faster

Beginning with ML 2.0: Multivariate Linear Regression

Beginning with Machine Learning: Linear Regression

Scrolling Progress Indicator