OneCompiler

Core Python....Descriptive

304

p=12
print(p)

print(type(p))

z = -87.7e100
print(type(z))

txt = "Hello all"
x = "cut" in txt
print(x)

age = "good"
txt = "hello i am {}"
print(txt.format(age))

list1 = [20, 25, 55,]
list.insert(5, 30)
list.append(28)
list.remove(30)
list.pop()
del list[0]
list.insert(1, 85)
print(list1)

list2 = ("dhruv", "raj", "sua")

y = list(list2)

y[0] = "ram"

list2 = tuple(y)

print(list2)

list1.extend(list2)
print(list1)

a = 10
while a < 60:
print(a)
if a == 30:
break
a += 10

for a in range(2,30,6):
print(a)
else:
print("range over")

def my_function():
print("my first function")

def my_function(fname,lname):
print(fname + "see" + lname)
my_function("solar", "dude")

def my_function(county = "india"):
print("i am from " + county)
my_function("philipines")
my_function("italy")
my_function()
my_function("kombodia")

def my_funt(x):
return 5 * x
print(my_funt(2))
print(my_funt(6))

x = lambda a : a + 10
print(x(5))

class myfirst:
x="hello dear"
pl = myfirst()
print(pl.x)

class student:
def init(self, fname, mname, lname):
self.fname = fname
self.mname = mname
self.lname = lname

p1 = student
fname = input("enter fname:")
print(p1.fname)
mname = input("enter mname:")
print(p1.mname)
lname = input("enter lname")
print(p1.lname)

a = 1
b = 1
while a <= 5:
print("hello")
while b <= 4:
print("dhruv")
b=b+1
a=a+1