2021-civ-73 python
2021-civ-73 python
[1]: x = 2
y = 4
print (x*y)
[2]: x = 5 + 7
print (x)
type (x)
12
[2]: int
HelloWrold
[4]: str
[5]: x = 98.6
type (x)
[5]: float
5.289999999999999
[7]: x = 10/2
print (x)
5.0
1
[1]: x = 42
f = float(x)
type (x)
f = float(x)
print (f)
42.0
[9]: x = '123'
y = int(x) + 1
print (y)
124
1st Number = 12
2nd Number = 13
Sum = 25
enter No. 58
large
[21]: #start
x = input('No. 1 =')
y = input('No. 2 =')
if int(x)>int(y):
2
print ('No. 1 > No. 2')
else:
print ('No. 2 > No. 1')
#End
No. 1 = 23
No. 2 = 32
No. 2 > No. 1
Enter a No. = 5
x is 5
1st No. 2
2nd No. 4
waht do you want sum subtract divide Multiply
3
Enter Operation adf
Invalid Operation
Enter a Number -2
Enter a +ve No. only
Enter a Number -4
Enter a +ve No.
4
[41]: #Program for calculating the total marks, % of students
try:
x = input('Enter the no. of Maths')
y = input('Enter the no. of English')
z = input('Enter the no. of Urdu')
if int(x) > 100 or int(y) > 100 or int(z)>100:
print('Enter marks from 0 to 100')
elif int(x) < 0 or int(y) < 0 or int(z)<0:
print('Enter marks from 0 to 100')
else:
Total = int(x)+int(y)+int(z)
per = (Total/300)*100
print ('Total marks =',Total)
print ('%age =', per)
if per >= 90:
print('Grade: A')
elif per >= 80:
print ('Grade: B')
elif per >= 70:
print ('Grade: C')
elif per >= 60:
print ('Grade: D')
elif per < 60:
print ('Grade: F')
except:
print ('Enter a Numeric No.')
Hello
5
[44]: 'no. is positive'
[45]: 4
[47]: n = 5
while n > 0:
print (n)
n = n - 1
5
4
3
2
1
5
4
3
2
1
[ ]: