Age-Calculator

Mon 30 June 2025
from datetime import datetime
def get_age(d):
    d1 = datetime.now()
    months = (d1.year - d.year) * 12 + d1.month - d.month

    year = int(months / 12)
    return year
age = get_age(datetime(1991, 1, 1))
age
33


Score: 5

Category: basics


Books

Mon 30 June 2025
!pip install requests beautifulsoup4 pandas matplotlib seaborn wordcloud
Requirement already satisfied: requests in c:\users\hp\miniconda3\envs\py312\lib\site-packages (2.32.4)
Requirement already satisfied: beautifulsoup4 in c:\users\hp\miniconda3\envs\py312\lib\site-packages (4.12.3)
Requirement already satisfied: pandas in c:\users\hp …

Category: basics

Read More

Covid

Mon 30 June 2025
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

sns.set(style="darkgrid")
data = {
    'Country': ['USA', 'India', 'Brazil', 'Russia', 'UK', 'France', 'Spain', 'Italy'],
    'TotalCases': [34000000, 31000000, 19000000, 7000000, 5000000, 5800000, 3700000, 4200000],
    'TotalDeaths': [610000, 410000, 530000, 190000, 130000, 110000, 81000, 127000],
    'TotalRecovered': [28000000, 30000000, 17000000, 6500000 …

Category: basics

Read More

Data002

Mon 30 June 2025
# Topic: Functions
def greet(name='User'):
    print(f'Hi, {name}')
greet()
# Topic: Lists & Tuples
t = (1, 2, 3)
print(t[0])
# Topic: Pandas
import pandas as pd
df = pd.read_csv('file.csv')
print(df.head())
# Topic: Dictionaries & Sets
d = {'name': 'Fahd', 'age': 20}
print(d.get('name'))
# Topic: JSON & CSV …

Category: basics

Read More

Data003

Mon 30 June 2025
# Topic: CLI Tools
import sys
print(f'Arguments: {sys.argv}')
# Topic: NumPy
import numpy as np
a = np.array([1, 2, 3])
print(a + 5)
# Topic: OOP
class Student:
    def __init__(self, name): self.name = name
s = Student('Fahd')
print(s.name)
# Topic: Web Scraping
import requests
from bs4 import …

Category: basics

Read More

Employee

Mon 30 June 2025
pip install seaborn
Collecting seaborn
  Downloading seaborn-0.13.2-py3-none-any.whl.metadata (5.4 kB)
Requirement already satisfied: numpy!=1.24.0,>=1.20 in c:\users\hp\miniconda3\envs\py312\lib\site-packages (from seaborn) (2.3.1)
Requirement already satisfied: pandas>=1.2 in c …

Category: basics

Read More

Ev

Mon 30 June 2025
# Block 1: Import necessary libraries
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
import numpy as np
# Block 2: Load the dataset
# Sample EV adoption dataset (can replace with real one)
data = {
    'Country': ['USA', 'China', 'Norway', 'Germany', 'UK', 'India', 'France …

Category: basics

Read More

Expense

Mon 30 June 2025
# Import libraries
import pandas as pd
import matplotlib.pyplot as plt
# Define expense data
data = [
    {"Date": "2025-06-01", "Category": "Food", "Amount": 250},
    {"Date": "2025-06-03", "Category": "Transport", "Amount": 80},
    {"Date": "2025-06-05", "Category": "Rent", "Amount": 5000},
    {"Date": "2025-06-10", "Category": "Food", "Amount": 300},
    {"Date": "2025-06-15", "Category": "Shopping", "Amount": 1200},
    {"Date": "2025-06-20", "Category": "Entertainment", "Amount …

Category: basics

Read More

File

Mon 30 June 2025
# Create sample text
sample_text = """
Python is an amazing programming language.
It is popular for data science, AI, and more.
Python emphasizes code readability.
"""
# Write to file
with open("sample.txt", "w") as f:
    f.write(sample_text)
# Read the file
with open("sample.txt", "r") as f:
    content = f.read()

print …

Category: basics

Read More

Hypernotes 1

Mon 30 June 2025
# Cell 1 — Topic: Recursion
def fact(n): return 1 if n==0 else n*fact(n-1)
print(fact(5))
# Cell 2 — Topic: Recursion
def fact(n): return 1 if n==0 else n*fact(n-1)
print(fact(5))
# Cell 3 — Topic: Pandas
import pandas as pd
df = pd.read_csv('file …

Category: basics

Read More
Page 1 of 5

Next »