OUTPUT:
Enter the marks of five subjects:
75
85
90
80
70
The Total marks is:400/500
The Average marks is: 80
The Percentage is: 88%
The Grade is: B
OUTPUT:
Enter the number of variables (N): 3
Enter 3 values:
Value 1: 1
Value 2: 2
Value 3: 3
Enter the number of positions to rotate: 2
Enter the direction of rotation ('right' or 'left'): left
Original List: [1, 2, 3]
List after rotating 2 positions to the left: [3, 1, 2]
OUTPUT:
1. Input: a = 1, b = -3, c = 2
Output: The roots are real and distinct: 2.00, 1.00
2. Input: a = 1, b = 2, c = 1
Output: The root is real and repeated: -1.00
3. Input: a = 1, b = 1, c = 1
Output: The roots are complex: (-0.5+0.866j), (-0.5-0.866j)
OUTPUT:
Enter the coefficient of a: 3
Enter the coefficient of b: 4
Enter the coefficient of c: 5
The roots are complex: -0.67 ± 1.11i
OUTPUT:
Enter the number of terms (n): 4
The sum of the series 1² + 2² + ... + 4² is: 30
OUTPUT:
1
12
123
1234
12345
OUTPUT:
1
12
123
1234
12345
OUTPUT:
Enter first number: 10
Enter second number: 5
Choose operation: +, -, *, /
Enter operation: *
Result: 50.0
OUTPUT:
First character: p
Last character: g
Substring [1:5]: ytho
Concatenation: python programming Python
Repetition: python programming python programming
Upper case: PYTHON PROGRAMMING
Lower case: python programming
Title case: Python Programming
Strip spaces: python programming
Replace: python programming (No "Python" found to replace)
Find 'a': 10
Count 'a': 1
Split string: ['python', 'programming']
Joined string: python-programming
Is alphabetic? False
Is numeric? False
Is alphanumeric? False
Is space? False
OUTPUT:
Original List: [10, 20, 30, 40, 50]
First element: 10
Last element: 50
Slicing [1:4]: [20, 30, 40]
After append: [10, 20, 30, 40, 50, 60]
After insert at index 2: [10, 20, 25, 30, 40, 50, 60]
After extend: [10, 20, 25, 30, 40, 50, 60, 70, 80]
After remove 25: [10, 20, 30, 40, 50, 60, 70, 80]
After pop: [10, 20, 30, 40, 50, 60, 70] Popped element: 80
After delete first element: [20, 30, 40, 50, 60, 70]
After updating index 1: [20, 35, 40, 50, 60, 70]
After sorting: [20, 35, 40, 50, 60, 70]
After reversing: [70, 60, 50, 40, 35, 20]
Index of 40: 3
Is 50 in list? True
OUTPUT:
Original Tuple: (10, 20, 30, 40, 50)
First element: 10
Last element: 50
Slicing [1:4]: (20, 30, 40)
Concatenated Tuple: (10, 20, 30, 40, 50, 60, 70)
Repeated Tuple: (10, 20, 30, 40, 50, 10, 20, 30, 40, 50)
Length of tuple: 5
Count of 20: 1
Index of 40: 3
OUTPUT:
Set1: {40, 10, 20, 30}
Set2: {50, 60, 40, 30}
After add 70 to Set1: {40, 70, 10, 20, 30}
After update Set1 with [80, 90]: {40, 70, 10, 80, 20, 90, 30}
After removing elements: {40, 70, 80, 90, 30}
After pop: {70, 80, 90, 30} Popped element: 40 <-- (Value may change)
Union: {70, 80, 90, 30, 40, 50, 60}
Intersection: {30, 40}
Difference (set1 - set2): {70, 80, 90}
Symmetric Difference: {70, 80, 90, 50, 60}
Is 30 in Set1? True
Is 100 not in Set2? True
OUTPUT:
Original Dictionary: {'Name': 'Alice', 'Age': 25, 'City': 'New York'}
Name: Alice
Age using get(): 25
After adding/updating: {'Name': 'Alice', 'Age': 26, 'City': 'New York', 'Country': 'USA'}
After pop City: {'Name': 'Alice', 'Age': 26, 'Country': 'USA'}
After popitem: {'Name': 'Alice', 'Age': 26} Popped item: ('Country', 'USA')
Keys: dict_keys(['Name', 'Age'])
Values: dict_values(['Alice', 26])
Items: dict items([('Name', 'Alice'), ('Age', 26)])
Is 'Name' in dictionary? True
Is 'City' in dictionary? False
OUTPUT:
Name Roll Marks
Bob 102 92
David 104 90
Alice 101 85
Charlie 103 78
OUTPUT:
Original Array: [10 20 15 30 25]
Array + 5: [15 25 20 35 30]
Array * 2: [20 40 30 60 50]
Sum: 100
Mean: 20.0
Maximum: 30
Minimum: 10
Sorted Array: [10 15 20 25 30]
Reshaped Array (1x5):
[[10 20 15 30 25]]
Random Array: [47 12 89 23 56]
Matrix Product:
[[19 22]
[43 50]]
OUTPUT:
Integral of x^2 from 0 to 5: 41.66666666666667
Solution of linear system: [2. 3.]
Root of x^3 - 4x - 9 = 2.855584521
Interpolated value at x=2.5: 5.0
OUTPUT:
Original Data Frame:
Name Age Marks
0 Alice 25 85
1 Bob 30 92
2 Charlie 22 78
3 David 28 90
Names Column:
0 Alice
1 Bob
2 Charlie
3 David
Name: Name, dtype: object
First 2 rows:
Name Age Marks
0 Alice 25 85
1 Bob 30 92
Updated Data Frame:
Name Age Marks
0 Alice 26 85
1 Bob 31 92
2 Charlie 23 78
3 David 29 90
Mean Marks: 86.25
Maximum Marks: 92
Sorted by Marks descending:
Name Age Marks
1 Bob 31 92
3 David 29 90
0 Alice 26 85
2 Charlie 23 78
Students with Marks > 80:
Name Age Marks
0 Alice 26 85
1 Bob 31 92
3 David 29 90
OUTPUT:
--- Student Record Management ---
1. Add Student
2. Display Students
3. Search Student
4. Update Student
5. Delete Student
6. Exit
Enter your choice: 1
Enter Name: Alice
Enter Roll Number: 101
Enter Age: 20
Enter Marks: 85
Student added successfully!
--- Student Record Management ---
1. Add Student
2. Display Students
3. Search Student
4. Update Student
5. Delete Student
6. Exit
Enter your choice: 1
Enter Name: Bob
Enter Roll Number: 102
Enter Age: 21
Enter Marks: 90
Student added successfully!
--- Student Record Management ---
1. Add Student
2. Display Students
3. Search Student
4. Update Student
5. Delete Student
6. Exit
Enter your choice: 2
Student Records:
{'Name': 'Alice', 'Roll': '101', 'Age': '20', 'Marks': '85'}
{'Name': 'Bob', 'Roll': '102', 'Age': '21', 'Marks': '90'}
--- Student Record Management ---
1. Add Student
2. Display Students
3. Search Student
4. Update Student
5. Delete Student
6. Exit
Enter your choice: 3
Enter Roll Number to search: 101
Student found: {'Name': 'Alice', 'Roll': '101', 'Age': '20', 'Marks': '85'}
--- Student Record Management ---
1. Add Student
2. Display Students
3. Search Student
4. Update Student
5. Delete Student
6. Exit
Enter your choice: 4
Enter Roll Number to update: 102
Enter new Name: Bob Martin
Enter new Age: 22
Enter new Marks: 92
Student updated successfully!
--- Student Record Management ---
1. Add Student
2. Display Students
3. Search Student
4. Update Student
5. Delete Student
6. Exit
Enter your choice: 2
Student Records:
{'Name': 'Alice', 'Roll': '101', 'Age': '20', 'Marks': '85'}
{'Name': 'Bob Martin', 'Roll': '102', 'Age': '22', 'Marks': '92'}
--- Student Record Management ---
1. Add Student
2. Display Students
3. Search Student
4. Update Student
5. Delete Student
6. Exit
Enter your choice: 5
Enter Roll Number to delete: 101
Student deleted successfully!
--- Student Record Management ---
1. Add Student
2. Display Students
3. Search Student
4. Update Student
5. Delete Student
6. Exit
Enter your choice: 2
Student Records:
{'Name': 'Bob Martin', 'Roll': '102', 'Age': '22', 'Marks': '92'}
--- Student Record Management ---
1. Add Student
2. Display Students
3. Search Student
4. Update Student
5. Delete Student
6. Exit
Enter your choice: 6
Existing program...