0% found this document useful (0 votes)
2 views

function aviral - Jupyter Notebook2

Uploaded by

Ayush Prakash
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

function aviral - Jupyter Notebook2

Uploaded by

Ayush Prakash
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

In [3]: def fun (a,b,c):

if(a>=b and a>=c):


return a
elif(b>=a and b>=c):
return b
else:
return c
x=int(input("enter first"))
y=int(input("enter second"))
z=int(input("enter third"))
ma=fun(x,y,z)
print("maximum is", ma)

enter first999999999999
enter second10000000000000000
enter third9999999999999999999
maximum is 9999999999999999999

In [ ]: def fun (a,b,c):


if(a>=b and a>=c):
return c
elif(b>=a and b>=c):
return b
else:
return a

x=int(input("enter first"))
y=int(input("enter second"))
z=int(input("enter third"))
ma=fun(x,y,z)
print("minimum is",ma)

In [1]: def area (a=10,b=20,c=30):


print("value of a",a)
print("value of a",b)
print("value of a",c)
area()

value of a 10
value of a 20
value of a 30

In [2]: def area (a=10,b=20,c=30):


print("value of a",a)
print("value of a",b)
print("value of a",c)
area(20)

value of a 20
value of a 20
value of a 30
In [3]: def area (a=10,b=20,c=30):
print("value of a",a)
print("value of a",b)
print("value of a",c)
area(20,30)

value of a 20
value of a 30
value of a 30

In [4]: def area (a=10,b=20,c=30):


print("value of a",a)
print("value of a",b)
print("value of a",c)
area(20,30,40)

value of a 20
value of a 30
value of a 40

In [5]: def area (a=10,b=20,c=30):


print("value of a",a)
print("value of a",b)
print("value of a",c)
area(,,40)

File "<ipython-input-5-b8b733393c2e>", line 5


area(,,40)
^
SyntaxError: invalid syntax

In [1]: x=int(input("number"))
y=int(input("power"))
z=int(input("divide by"))
s=pow(x,y,z)
print(s)

number10
power2
divide by3
1

In [2]: f=open('avi.bgmi','w')
f.write('THIS IS AVIRAL')
f.close()
In [5]: f=open("avi.bgmi",'r')
s=f.read()
l=len(s)
c=0
v='aeiouAEIOU'
for i in range(0,l):
if (s[i] in v):
c=c+1
print("no vovel of",c)

no vovel of 10

In [3]: mySubject = "Computer Science"


print(mySubject[0:len(mySubject)],"1")
print(mySubject[-7:-1])
print(mySubject[::2])
print(mySubject[len(mySubject)-1])
print(2*mySubject)
print(mySubject[::-2])
print(mySubject[:3] + mySubject[3:])
print(mySubject.swapcase())
print(mySubject.startswith('Comp'))
print(mySubject.isalpha())

Computer Science 1
Scienc
Cmue cec
e
Computer ScienceComputer Science
eniSrtpo
Computer Science
cOMPUTER sCIENCE
True
False

In [4]: def wfun():


l=[]
ans='y'
while ans=='y':
s=input("string enter karde")
l.append(s)
ans=input('y or n')
x=open('bro','w')
x.writelines(l)
x.close()
wfun()

string enter karde8989


y or nn
In [2]: def wfun():
l=[]
ans='y'
while ans=='y':
s=input("string enter karde")
s=s+ '\n'
l.append(s)
ans=input('y or n')
x=open('bro','w')
x.writelines(l)
x.close()
wfun()

string enter kardekarde bhyii


y or ny
string enter kardehelooo
y or ny
string enter kardeloooo
y or nn

In [ ]: ​

You might also like