0% found this document useful (0 votes)
27 views8 pages

Suhani Govil Ai File

Uploaded by

itz.suh31
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)
27 views8 pages

Suhani Govil Ai File

Uploaded by

itz.suh31
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/ 8

1.

age= int(input("Enter your age: "))


if age >= 18:
print("You are eligible to vote.")
else:
print("You are not eligible to vote.")

2. marks = int(input("Enter your marks: "))


if marks >= 90:
grade = 'A'
elif marks >= 80:
grade = 'B'
elif marks >= 70:
grade = 'C'
elif marks >= 60:
grade = 'D'
else:
grade = 'F'
print("Your grade is",grade)

3. number = float(input("Enter a number: "))


if number > 0:
print("The number is positive.")
elif number < 0:
print("The number is negative.")
else:
print("The number is zero.")
4. for i in range(1, 11):
print(i)

5. sum_of_numbers = 0
for i in range(1, 11):
sum_of_numbers += i
print("The sum of the first 10 natural numbers is:",
sum_of_numbers)

6. children = ["Arjun", "Sonakshi", "Vikram",


"Sandhya", "Sonal", "Isha", "Kartik"]
#i. Print the whole list
print("Original List:", children)
#ii. Delete the name “Vikram” from the list
children.remove("Vikram")
print("List after removing 'Vikram':", children)
#iii. Add the name “Jay” at the end
children.append("Jay")
print("List after adding 'Jay':", children)
#iv. Remove the item.
children.pop(1)
print("List after removing the second item:",
children)

7. # List of numbers
num = [23, 10, 15, 90, 68, 45]
#i. Print the length of the list
print("Length of the list:", len(num))
#ii. Print the elements from second to fourth
position using positive indexing
print("Elements from second to fourth position
(positive indexing):", num[1:4])
#iii. Print the elements from position third to fifth
using negative indexing
print("Elements from third to fifth position
(negative indexing):", num[-4:-1])

8. even_numbers = [2, 4, 6, 8, 10]


updated_list = [num + 1 for num in
even_numbers]
print("Final list after adding 1 to each element:",
updated_list)
9. List_1 = [70, 80, 60, 40]
List_1.extend([24, 25, 22])
List_1.sort()
print("Final sorted list:", List_1)
list1 = [1, 2, 3, 4, 5]
list2 = [6, 7, 8, 9, 10]
sum_list = [a + b for a, b in zip(list1, list2)]
print("Sum of elements from the two lists:",
sum_list)

10. import numpy as np from scipy import stats

11. data = [1, 2, 3, 4, 5, 5, 6, 7, 8, 9]


# Calculate mean
mean = np.mean(data)
# Calculate median
median = np.median(data)
#Calculate mode
mode = stats.mode(data)
print(f"Mean: {mean}")
print(f"Median: {median}")
print(f"Mode: {mode.mode[0]}")

12.import matplotlib.pyplot as plt


x = [2, 9]
y = [5, 10]
plt.plot(x, y, marker='o')
plt.title("Line Chart from (2,5) to (9,10)")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.show()

13. import matplotlib.pyplot as plt


x = [2, 9, 8, 5, 6]
y = [5, 10, 3, 7, 18]
plt.scatter(x, y, color='blue')
plt.title("Scatter Plot for Given Points")
plt.xlabel("X-axis")
plt.ylabel("Y-axis")
plt.show()

14. import pandas as pd


file_path = 'file_path.csv'
df = pd.read_csv(file_path)
print(df.head(10))

15. file_path = 'file_path.csv'


df = pd.read_csv(file_path)
print(df.info())

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy