(Bat 6py - C:/Users/ROG/Desktop/q16.py 3.8.4)
File Edit Format Run Options Window Help
# Q)16
largest = 0
second = 0
while True :
n = int(input ("enter a number (to stop enter 0): "))
ifn == 0:
break
else :
if n> largest
second = largest
largest =n
print (second,"is second biggest number ")|
Lin 12 Cok 41[Bi Python 384 Shell
File Edit Shell
Debug Options Window Help
- a x
Python 3.8.4
D64)]
Type “help",
>>>
enter
enter
enter
enter
enter
enter
enter
enter
enter
enter
enter
4566
>>> |
on win32
number
number
number
number
number
number
number
number
number
number
number
pop opapapew
(to
{to
(to
(to
(to
(to
{to
(to
{to
(to
{to
(tags/v3.8.
"copyright",
stop
stop
stop
stop
stop
stop
stop
stop
stop
stop
stop
is second biggest
enter
enter
enter
enter
enter
enter
enter
enter
enter
enter
enter
number
fae45a,
0):
0):
Oo):
0):
o):
0)
0)
0)
0)
oy:
0):
‘Jul 13 2020,
456
64566
566
656563
635
67890
098765
4345
345466
4
0
16:46:45)
RESTART: C:/Users/ROG/Desktop/ql6.py
[MSC v.1924 64 bit (AM
“credits" or “license()" for more information.
in: 17 Col4(Bat 6py - C:/Users/ROG/Desktop/q16.py 3.8.4) ie o Se
File Edit Format Run Options Window Help
# Q)21
n = int (input ("Enter the value of n : “)}
su
for i in range(1, n+1):
fact=1
for j in range(1, itl):
fact*=j
sum+=(1/fact)
print ("the sun of the sequence is: ",sum)|
Ln:9 Col:41& Python 3.8.4 Shell = o oe
File Edit Shell Debug Options Window Help
Python 3.8.4 (tags/v3.8.4:dfa645a, Jul 13 2020, 16:46:45) [MSC v.1924 64 bit (aM
Dé64)] on win32
Type "help", "copyright"
>>>
"credits" or "license()" for more information.
= RESTART: C:/Users/ROG/Desktop/q1é.py
Enter the value of n: 4
the sun of the sequence is: 2.708333333333333
>>>
Ln:7 Cok4Bi cspy - C/Users/ROG/Desktop/cs.py (3.8.4) ie a Se
File Edit Format Run Qptions Window Help
# 22
al=a2=a3=0
while True
age = int(input ("Enter the age of the employee (0 to stop): "))
if age
elif age>=36 and age<=45:
a2t
elif age
a3t=l
print ("The number of employees of age 26-35: ",al)
print ("The number of employees of age 36-45: ",a2)
print("The number of employees of age 46-55: ",a3)
age<=55:
Lin: 16 Col 0(&. Python 3.8.4 Shell = o Se
File Edit Shell Debug Options Window Help
Python 3.8.4 (tags/v3.8.4:dfa645a, Jul 13 2020, 16:46:45) [MSC v.1924 64 bit (AM
Dé64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
RESTART: C:/Users/ROG/Desktop/cs.py
Enter the age of the employee (0 to stop): 34
Enter the age of the employee (0 to stop}: 53
Enter the age of the employee (0 to stop): 50
Enter the age of the employee (0 to 42
Enter the age of the employee (0 to 41
Enter the age of the employee (0 to 28
Enter the age of the employee (0 to : 26
Enter the age of the employee (0 to 2: aa
Enter the age of the employee (0 to 247
Enter the age of the employee (0 to 49
Enter the age of the employee (0 to 38
Enter the age of the employee (0 to 0
The number of employees of age 26-35: 4
The number of employees of age 36-45: 3
The number of employees of age 46-55: 4]
>>>
Ln 19 Col:40(Bi *cs.py - C/Users/ROG/Desktop/cs.py (3.8.4)* ie a Se
File Edit Format Run Qptions Window Help
# )23)a)
x=int (input ("Enter the value of x: "))
Sum=0
for i in range(1, 6):
fact=1
for j in range(1, itl):
((x**4) /fact)
sum 45 ((x¥*i) /fact)
print(*the sum of the sequence is: *,sum)
Ln:7 Col0Nt ash Sartre tN nh recto Retin, iit
Peas
CnC Lae cae
SLUM ee
79 .68333333333334TB cspy - C/Users/ROG/Desktop/cs.py 3.8.4)
File Edit Format Run Options Window Help
# )23)b)
int (input ("Enter the value of x: "))
int (input ("Eater the value of a: "))
x
a
sur
for i in range (1,n+1):
sumt= (x**i) /i
print ("The sum is", sum)(& Python 3.8.4 Shell = o oe
file Edit Shell Debug Options Window Help
Python 3.8.4 (tags/v3.8.4:dfa645a, Jul 13 2020, 16:46:45) [MSC v.1924 64 bit (aM
Dé64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
RESTART: C:/Users/ROG/Desktop/cs-py
Enter the value of x: 5
Enter the value of a
The sum is 14605.297619047618
oo |
Ln:8 Colk4A cspy - C/Users/ROG/Desktop/cs.py (3.8.4)
File Edit Format Run Qptions Window Help
# Q)26
for i in range (6}:
for j in range (20)
print ("*", end='")
print()&. Python 3.8.4 Shell = o Se
File Edit Shell Debug Options Window Help
Python 3.8.4 (tags/v3.8.4:dfa645a, Jul 13 2020, 16:46:45) [MSC v.1924 64 bit (AM
Dé4)] on win32
Type "help", "
>>>
copyright", "credits" or "license()" for more information.
RESTART: C:/Users/ROG/Desktop/cs-py
errr eee eereers
Serer seers
Sobre ERE
keener Ee
>>>
in 11 Col4B.*q30 py - C/Users/ROG/Desktop/q30.py (3.8.4)*
File Edit Format Run Options Window Help
# Q)30
n = int (input ("Enter the maximum value to display: "))
#1 is neither prime nor composite
print('1 = 1')
for i in range (2,n+1):
fact=0
#Number of factors
for j in range(1,it1):
if i8j
fact:
#if factors are 2 then its prime
if fact:
print (i,
else:
string=str(i)+' = '
#Prime factors of the number
for j in range(i):
fact=0
for x in range(1,j+#1):
ri," (prime) ")
if fact==2:
#If the factor is prime
count=0
#Duplicating the number
n=i
while (nj
countt=1
n//=j
for y in range (count):
stringt=str(j)+'x!
#Removing the last 'x' sign
print (string[:-1])
#Yash Choukiker 11-c rollno.34
Lin 34 Cok 33&. Python 3.8.4 Shell = o oe
File Edit Shell Debug Options Window Help
Python 3.8.4 (tags/v3.8.4:dfa645a, Jul 13 2020, 16:46:45) [MSC v.1924 64 bit (aM
Dé64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
RESTART: C:/Users/ROG/Desktop/q30.py
Enter the maximum value to display: 13
tea
2 = 2 (prime)
3 = 3 (prime)
4 = 2x2
5 = 5 (prime)
6 = 2x3
7 =7 (prime)
8 = 2x2x2
9 = 3x3
10 = 2x5
11 = 11 (prime)
12 = 2x2x3
13 = 13 (prime)
35> |
in 19 Col: 4