This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| def simulate_coin_flips(n_flips): | |
| """ | |
| Simulates n_flips coin tosses. | |
| 'Heads' is represented by 1, and 'Tails' by 0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Task12a | |
| # importing libraries | |
| import pygame | |
| import time | |
| import random |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TASK 11A | |
| import tkinter as tk | |
| # Function to change font style | |
| def change_font(): | |
| label.config(font=("Arial", 18, "bold")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Task10a | |
| import matplotlib.pyplot as plt | |
| languages = ['Java', 'Python', 'PHP', 'JavaScript', 'C#', 'C++'] | |
| popularity = [22.2, 17.6, 8.8, 8, 7.7, 6.7] | |
| plt.bar(languages, popularity, color='b') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TASK 9A | |
| # Initialize the list of grades | |
| grades = [85, 90, 78, 92, 88] | |
| # Display the grades list | |
| print("Grades List:", grades) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Task8a | |
| def number_sequence(start, end, step=1): | |
| current = start | |
| while current <= end: | |
| yield current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Task7a | |
| def analyze_student_grades(): | |
| # Sample data | |
| student_names = ["Alice", "Bob", "Charlie", "Diana"] | |
| student_grades = [85, 92, 78, 90] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Task6a | |
| def copy_files(file_paths): | |
| for file_path in file_paths: | |
| if os.path.exists(file_path): | |
| with open(file_path, 'r') as original_file: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TASK 5A | |
| def find_employee_by_id(employees, target_id): | |
| for employee in employees: | |
| if employee['id'] == target_id: | |
| return employee |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Task4a | |
| #Add Elements: Add elements to the list. | |
| list=[10,20] | |
| a=30 | |
| list.append(a) |
NewerOlder