import math
print([Link])
print([Link])
print([Link](3.54))
print([Link](3.54))
print([Link](16))
print([Link](90))
print([Link](90))
print([Link](10))
print(math.log10(10))
print([Link](3,3))
print([Link](45))
import pandas as pd
data={'name':["john", "anjali"], 'marks':[79,80], 'grade':[7, 7] }
df=[Link](data, index=['s1','s2'] )
print(df)
data=[89,79,67]
ser=[Link]([10.9,20.7,30.6,40.5])
print(ser)
print([Link]())
import numpy as np
data=[Link]([[10,20],[30, 40]])
[Link](data)
file=open('[Link]', 'r')
print([Link]())
n1=int(input("enter no1:"))
n2=int(input("enter no2:"))
try:
res=n1/n2
except:
print("Please donot enter 0 for n2")
else:
print(res)
finally:
#resource close code
print("This finally block")
def check_positive(no):
if no<0:
raise ValueError("The value error.")
else:
return no
try:
print(check_positive(-1))
except TypeError:
print("the exception generate")
except ValueError:
print("the ValueError exception generate")
except:
print("the ValueError exception generate")
try:
n1=int(input("enter no1:"))
n2=int(input("enter no2:"))
res=n1/n2
except (ValueError, ZeroDivisionError) as e :
print("Please donot enter 0 for n2")
else:
print(res)
finally:
#resource close code
print("This finally block")
class vehical:
def __init__(self, nowheel, engine):
[Link]=nowheel
[Link]=engine
def vehical_description(self):
print("The vehical :",[Link]," Engine:", [Link])
def start(self):
print("vehical is starting")
def stop(self):
print("vehical is stopped")
class car(vehical):
def __init__(self, color, model, speed):
[Link]=color
[Link]=model
[Link]=speed
self.__no=34
def get_no(self):
return self.__no
def set_no(self, number):
self.__no=number
def car_description(self):
print("The car color is :",[Link]," model:", [Link]," and speed:
",[Link])
def start(self):
print("car is starting")
def stop(self):
print("car is stopped")
def accelarate(slef):
print("car is runnig")
c1=car('Red', 'Sedan', 120)
c1.car_description() #car_description(c1)
c2=car('Blue', 'SUV', 100)
c2.car_description() #car_description(c2)
[Link]()
print(c2.set_no(100))
print(c2.get_no())
import [Link]
mydb = [Link](
host="localhost",
user="root",
password="bismillah",
database="studentdb"
)
mycursor = [Link]()
#[Link]("insert into student values(11,'Amit', 7, 101)")
#[Link]("update student set gade='5' where sid=11")
[Link]("delete from student where sid=11")
[Link]()
[Link]("select * from student")
myresult = [Link]()
for x in myresult:
print(x)
[Link]()
from flask import Flask, render_template, request, redirect, url_for
app=Flask(__name__)
tasks=[]
@[Link]('/dispTask')
def dispTask():
return render_template('[Link]', tasks=tasks)
@[Link]('/addTask', methods=['POST'])
def addTask():
task = [Link]['task']
[Link](task)
return redirect(url_for('dispTask'))
if __name__ == '__main__':
[Link](debug=True)
<!Doctype>
<html>
<head>
<title>First Flask App</title>
</head>
<body>
<h2>Tasks</h2>
<ul>
{% for task in tasks %}
<li>{{ task }} <input type="checkbox" name="completed"></li>
{% endfor %}
</ul>
<form action="/addTask" method="POST">
<input type="text" name="task">
<input type="submit" value="Add Task">
</form>
</body>
</html>