Grade 10 AI Practical File With Solutions (HIBA KHAN - 10F)
Grade 10 AI Practical File With Solutions (HIBA KHAN - 10F)
KHAN - 10F)
```python
num = int(input("Enter a number: "))
if num % 2 == 0:
print(f"{num} is even.")
else:
print(f"{num} is odd.")
```
if choice == 1:
print(f"Result: {num1 + num2}")
elif choice == 2:
print(f"Result: {num1 - num2}")
elif choice == 3:
if num2 != 0:
print(f"Result: {num1 / num2}")
else:
print("Division by zero is not allowed.")
elif choice == 4:
print(f"Result: {num1 * num2}")
else:
print("Invalid choice.")
```
data = [5,6,1,3,4,5,6,2,7,8,6,5,4,6,5,1,2,3,4]
while True:
print("\nMenu:")
print("1. Calculate Mean")
print("2. Calculate Mode")
print("3. Calculate Median")
print("4. Exit")
Data:`[33,44,55,67,54,22,33,44,56,78,21,31,43,90,21,33,44,55
,87]`
Code:
```python
import statistics
data =
[33,44,55,67,54,22,33,44,56,78,21,31,43,90,21,33,44,55,87]
while True:
print("\nMenu:")
print("1. Calculate Variance")
print("2. Calculate Standard Deviation")
print("3. Exit")
---
Data Visualization
plt.bar(languages, ratings)
plt.title("Programming Language Ratings")
plt.xlabel("Languages")
plt.ylabel("Ratings")
plt.show()
```
data = {
'Maths': [74.5, 76.5, 95, 86],
'Science': [89, 95, 79, 92],
'SST': [87, 91, 82, 72]
}
plt.boxplot(data.values(), labels=data.keys())
plt.title("Boxplot of Marks")
plt.ylabel("Marks")
plt.show()
```
7. Write a Python program to construct a scatter plot for
height and weight of students.
Data: Heights: `[120, 145, 130, 155, 160, 135, 150, 145,
130, 140]`; Weights: `[40, 50, 47, 62, 60, 55, 58, 52,
50, 49]`.
Code:
```python
import matplotlib.pyplot as plt
height = [120, 145, 130, 155, 160, 135, 150, 145, 130,
140]
weight = [40, 50, 47, 62, 60, 55, 58, 52, 50, 49]
plt.scatter(height, weight)
plt.title("Height vs Weight")
plt.xlabel("Height (cm)")
plt.ylabel("Weight (kg)")
plt.show()
```
marks = [22, 87, 5, 43, 56, 73, 55, 54, 11, 20, 51, 5,
79, 31, 27]
---
Grade 10 AI CV Programs
# Load an image
image = cv2.imread('personality.jpg')
cv2.imshow('Personality Image', image)
cv2.waitKey(0)
cv2.destroyAllWindows()
```
# Load an image
image = cv2.imread('personality.jpg')
print(f"Image dimensions: {image.shape}")
```
# Load an image
image = cv2.imread('personality.jpg',
cv2.IMREAD_GRAYSCALE)
min_val = np.min(image)
max_val = np.max(image)
# Load an image
image = cv2.imread('personality.jpg')
# Load an image
image = cv2.imread('personality.jpg')
# Load an image
image = cv2.imread('personality.jpg')
---