3.
Operators
Convert Minutes to Seconds
mintues = int(input("Enter number of mintues"))
seconds = mintues * 60
print(seconds)
Enter number of mintues2
120
A farmer is asking you to tell him how many legs can be counted among all his animals. The farmer breeds three species:
chickens = 2 legs
cows = 4 legs
pigs = 4 legs
The farmer has counted his animals and he gives you a subtotal for each species. You have to write a program to print the total number
of legs of all the animals.
chickens = int(input("Enter number of chickens"))
cows = int(input('Enter number of Cows'))
pigs = int(input('Enter number of pigs'))
total_legs = chickens * 2 + cows * 4 + pigs * 4
print(total_legs)
Enter number of chickens2
Enter number of Cows2
Enter number of pigs2
20
##input:
##total
s1 = int(input())
s2 = int(input())
s3 = int(input())
s4 = int(input())
s5 = int(input())
total_marks = int(input())
total_student_marks = s1 + s2 + s3 + s4 + s5
percentage = (total_student_marks / total_marks)*100
print(total_marks, percentage, "%")
25
25
25
25
25
125 25.0
1 - (-3)
int('10')
10
float('10.5')
10.5
int(10.5)
10
int('10.5')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Input In [9], in <cell line: 1>()
----> 1 int('10.5')
ValueError: invalid literal for int() with base 10: '10.5'
int(True)
int(False)
int(False)
bool(1)
True
bool(0)
False
bool(100)
True
bool(-100)
True
bool('satish')
True
bool('')
False
bool('False')
True
Doubts
a = input()
print(a*60)
10
101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101
010101010
'10'*10
'10101010101010101010'
'10' + '10'
'1010'
a=int(input("Enter minute: "))
b=a*60
print(b)
Enter minute: 10
600
Edabit.com
hackerrank.com
w3school
geeskforgeeks
S1 = int(input("S1 Marks"))
S2 = int(input("S2 Marks"))
S3 = int(input("S3 Marks"))
S4 = int(input("S4 Marks"))
S5 = int(input("S5 Marks"))
total_mark = S1 + S2 + S3 + S4 + S5
Persentage = (total_mark/500)*100
print(Persentage)
S1 Marks25
S2 Marks25
S3 Marks25
S4 Marks25
S5 Marks25
25.0
print(1, 3, 5, 7, 9)
1 3 5 7 9
bool(2)
True
a = 5
b = 5
type(print(a+b))
10
NoneType
Loading [MathJax]/jax/output/CommonHTML/fonts/TeX/fontdata.js