"P_record.csv" contains the records of patients in a hospital. Each record of the file contains the following data:["Gunjan", "Jaundice", 4, 15000]read_data() which reads all the data from the file and displays the details of all the 'Cancer' patients.count_rec() which counts and returns the number of records in the file.
def read_data():
try:
import csv
with open("P_record.csv", "r") as f:
reader = csv.reader(f)
for row in reader:
if row[1].lower() == "cancer":
print(row)
except FileNotFoundError:
print("File not found.")
Explanation:
def count_rec():
count = 0
try:
import csv
with open("P_record.csv", "r") as f:
reader = csv.reader(f)
for row in reader:
count += 1
return count
except FileNotFoundError:
print("File not found.")
return 0
Explanation:Draw a rough sketch for the curve $y = 2 + |x + 1|$. Using integration, find the area of the region bounded by the curve $y = 2 + |x + 1|$, $x = -4$, $x = 3$, and $y = 0$.