Lab-1
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32
win32
Type “help”, “copyright”
(Intel)] on
redits" or "license()" for more information.
QUE-A
1.>>> Age=20
>>> Age
20
2.>>> Name="Ar
>>> Name
‘Amit!
string type
>>> Name=Amit
Traceback (most recent call last):
File “", line 1, in
‘#wrong initialization
3.>>> Laptop@=10000000
Traceback (most recent call last):
File "", line 1, in
Laptop@=10000000
NameError: name ‘Laptop’ is not defined
>>> Laptop=10000000
>>> Laptop
10000000
4,>>> Surname=Sharma
Traceback (most recent call last): #Sharma isn't variable it is,
string
File “", line 1, in
Surmame=Sharma
ame ‘Sharma’ is not defined
>>> Surname
‘Sharma’QUE B
1.
5.>>> class="Advanced Theoretical Zymurgy’
‘SyntaxError: invalid syntax
>>> class1="Advanced Theoretical Zymurgy’
>>> class1
"Advanced Theoretical Zymurgy’
6. >>> zip code=2492
>>> zip code
2492
#octal value
SyntaxError: leading zeros in decimal integer literals are not
permitted; use an Oo prefix for octal integers
#correct syntax for declaring octal value
>>> phone
2016437
SyntaxError: invalid syntax
>>> _Street="for big parade’ hyphen can be used for declaration
>>> _Street
‘for big parade"
>>> minute=599.
>>> x
0,9833333333333333
D247
7
Dep x
0,9833333333333333
>>> xH17
17.983333333333334
>>> miles=26. 2
>>> print miles*1.61__ parentheses for print ()
‘SyntaxError: Missing parentheses in call to ‘print’. Did you mean
print(miles*1.61)?
>>> print (miles*1.61)
42.182
>>> print 1
SyntaxError: Mi
print(1)?
>>> print (1)
1
ing parentheses in call to ‘print’
>>> x=2
10. >>> print(x)
2
11. >>> x1
3
Quec
>>> width=17
>>> height=12.0
>>> delimiter="QUE-D
>>> type
>>> type(height)
>>> type(delimiter)
>>> width/2
85
>>> type(width)
>>> width/2.0
85
>>> type(width/2)
>>> type(width/2.0)
>>> height/3
40
>>> type(height/3)
>>> type(1#2*5)
>>> 142°5
"
>>> delimiter *5
>>> type(delimiter *5)
>> 442°3
10
>p> (4+2)'3
8
>>p 44(2"3)
10
pop 22
0
>>> pow(2,2)
4
>>> 243"(3+4)-pow(2,2) #braces,exponents, muti and division,add su19
QUE-E- Simple interest computati
>>> p=1000
>>> rst5
poe te3
>>> si=(p*r't/100_ # calculating simple interest
>>> si
450.0
>>> type(si)
>>>
QUE-F - Compound Interest computation
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926
32 bit (Intel)] on win32
Type “help”, “copyright
information.
>>> psint(input("enter principal amount:")) #input principal amount
enter principal amount:5000
>>> r=int(input(“enter interest rate:")) #input interest rate
enter interest rate:7
input("enter frequency of compoun
enter frequency of compounding:2
>>> teint(input("enter no of years:")) #years
enter no of years:15
>>> I=(p"(pow((1#(rin)),(n*t))))-p computing Cl
>>> print("compound interest is:",I) #printing CI
compound interest is: 1.97399213329033e+23
, “credits” or “license()" for more
QUE-G- Force calculation
>>> Fsfloat(input("enter the force:"))
enter the force:10
>>> mefloat(input("enter the mass value:"))enter the mass value:10
>>> a=float(input("enter the acceleration:"))
enter the acceleration:22.5,
>>> Femta #computing force
>>> print("TOTAL FORCE IS:",F)
TOTAL FORCE IS: 225.0
QUE-H- fahrenheit to celcius
>>> Fsfloat(input("enter the temperature in Fahrenhei
enter the temperature in Fahrenheit:76.833,
>>> C=(F-32)*(5/9)
>>> print("temperature in celcius is:",C)
14.907 222222222224
QUE4-celcius to fahrenheit
>>> C=float(input(“enter the temperature in celsius:"))
enter the temperature in celsius:24.9072
>>> FaC*(9/5)}+32
>>> print("temperature in fahrenheit is:
temperature in fahrenheit is: 76.83296
QUE. J-
Circle area
>>> r=float(input(
enter the radius:5.6
>>> A=(22/7)"pow(r.r)
>>> print("area of circle i
area of circle is: 48660.61483834473
QUE-K - volume of cylinder
>>> r=float(input("enter the radius of cyli
enter the radius of cylinder:4.2
>>> h=float(input("enter the height of cylinde
enter the height of cylinder:15
>>> V=(22/7)"pow(r,r)"h>>> print("Volume of cylinder is:",V)
Volume of cylinder is: 19546.226162632567
QUE-L - Surface area of cylinder
>>> r=float(input("enter the radius of cylinder:"))
enter the radius of cylinder:4.2
>>> h=float(input("enter the h
enter the height of cylinder:10
>>> AR(2"(22/7)"r1}#(2"(22/7)*r*h)
>>> print("Surface area of cylinder is:",A)
Surface area of cylinder is: 374.88
QUE-M- area of rectangular prism
>>> h=float(input("enter the h:"))
enter the h:12,
>>> defloat(input("enter the d:"))
enter the
>>> wefloat(input("enter the w:"))
enter the w:5.9
>>> area=2*((h*d)+(h*w)+(d*w))
>>> print("“area of rectangular prism is:",area)
area of rectangular prism is: 306.28
QUE-N- volume of rectangular prism
>>> h=float(input("enter the h:"))
enter the h:12
>>> d=float(input(“enter the d:"))
enter the d:4.6
>>> wefloat(input("enter the w:"))
enter the w:5.9
>>> volume=h*d'w
>>> print("volume of rectangular prism:",volume)
volume of rectangular prism: 325.68