0% found this document useful (0 votes)
23 views4 pages

labtest - Jupyter Notebook

Uploaded by

2361
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views4 pages

labtest - Jupyter Notebook

Uploaded by

2361
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

11/28/23, 2:53 PM labtest - Jupyter Notebook

In [4]: a=int(input("Enter the first number:"))


b=int(input("Enter the second number:"))
c=a+b
d=a-b
e=a*b
f=a/b
print(c)
print(d)
print(e)
print(f)

Enter the first number:5


Enter the second number:2
7
3
10
2.5

In [6]: a=int(input("Enter your rollno:"))


100//a

Enter your rollno:21

Out[6]: 4

In [8]: a=int(input("Enter your rollno:"))


100%a

Enter your rollno:21

Out[8]: 16

In [10]: import math

In [15]: a=2**6
print(a)
print("cube root of ",a," is ",round(a**(1/3)))

64
cube root of 64 is 4

In [19]: print(type(3.1444))
print(type(6))
print(type(2+3j))
print(type(8))
print(type('star'))

<class 'float'>
<class 'int'>
<class 'complex'>
<class 'int'>
<class 'str'>

localhost:8888/notebooks/labtest.ipynb 1/4
11/28/23, 2:53 PM labtest - Jupyter Notebook

In [25]: R=int(input("Enter your rollno:"))


a=complex(R,R+10)
print("The real part is ",a.real)
print("The imaginary part is ",a.imag)
print("The conjugate part is ",a.conjugate())

Enter your rollno:20


The real part is 20.0
The imaginary part is 30.0
The conjugate part is (20-30j)

In [26]: a=int(input("Enter the first number:"))


b=int(input("Enter the second number:"))
c=a%b
print("The reminder is:",c)

Enter the first number:5


Enter the second number:3
The reminder is: 2

In [31]: c=input("Enter the number:")


if '/' in c:
numerator,denominator=map(int,c.split('/'))
if denominator==0:
print("Undefined")
else:
print(c)

Enter the number:5/3


5/3

In [6]: def factor(a,b):


if b%a==0:
return True
else:
return False

In [7]: factor(5,25)

Out[7]: True

In [8]: factor(3,25)

Out[8]: False

In [9]: for i in range(0,10,2):


print(i)

0
2
4
6
8

localhost:8888/notebooks/labtest.ipynb 2/4
11/28/23, 2:53 PM labtest - Jupyter Notebook

In [10]: for i in range(0,10):


print(i)

0
1
2
3
4
5
6
7
8
9

In [14]: a=int(input("Enter the number:"))


print("The factors of ",a," is ")
for i in range(1,a+1):
if(a%i==0):
print(i)

Enter the number:10


The factors of 10 is
1
2
5
10

In [21]: def fact(a):


print("The factors of ",a," is ")
for i in range(1,a+1):
if(a%i==0):
print(i)

In [23]: f=int(input("Enter the number:"))


fact(f)

Enter the number:10


The factors of 10 is
1
2
5
10

In [25]: a=int(input("Enter the number:"))


for i in range(1,11):
b=a*i
print(a,"x",i,"=",b)

Enter the number:5


5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50

localhost:8888/notebooks/labtest.ipynb 3/4
11/28/23, 2:53 PM labtest - Jupyter Notebook

In [26]: a=int(input("Enter the number:"))


for i in range(1,11):
b=a*i
print("{0}x{1}={2}".format(a,i,b))

Enter the number:5


5x1=5
5x2=10
5x3=15
5x4=20
5x5=25
5x6=30
5x7=35
5x8=40
5x9=45
5x10=50

In [31]: def mul(a):


for i in range(1,11):
b=a*i
print("{0}x{1}={2}".format(a,i,b))

In [32]: a=int(input("Enter the number:"))


mul(a)

Enter the number:5


5x1=5
5x2=10
5x3=15
5x4=20
5x5=25
5x6=30
5x7=35
5x8=40
5x9=45
5x10=50

In [ ]: ​

localhost:8888/notebooks/labtest.ipynb 4/4

You might also like