Skip to content

Learn Python

  • Python
  • Cyber Security Basics
Learn Python
  • Python

    Date/Time Objects

    Byadmin October 1, 2025October 1, 2025

    Creating and Manipulating Date/Time Objects in Python 1. Creating Date and Time Objects Creating Date Objects python from datetime import date, time, datetime # Create date objects date1 = date(2023, 12, 25) # Christmas 2023 date2 = date(2024, 1, 1) # New Year 2024 date3 = date(2023, 6, 15) # Random date print(“Date Objects:”) print(f”Christmas:…

    Read More Date/Time ObjectsContinue

  • Python

    date time modules class55

    Byadmin October 1, 2025October 1, 2025

    In Python, the primary modules for handling dates and times are: 🕰️ Key Built-in Modules 1. datetime This is the most essential module. It provides classes for manipulating dates and times in both simple and complex ways. Class Description Example Usage date A date (year, month, day). date.today() time A time (hour, minute, second, microsecond,…

    Read More date time modules class55Continue

  • Python

    Challenge Summary: Inheritance – Polygon and Triangle Classes

    Byadmin September 30, 2025September 30, 2025

    Challenge Summary: Inheritance – Polygon and Triangle Classes Objective: Create two classes where Triangle inherits from Polygon and calculates area using Heron’s formula. 1. Polygon Class (Base Class) Properties: Methods: __init__(self, num_sides, *sides) python class Polygon: def __init__(self, num_sides, *sides): self.number_of_sides = num_sides self.sides = list(sides) 2. Triangle Class (Derived Class) Inheritance: Methods: __init__(self, *sides) area(self) python import math…

    Read More Challenge Summary: Inheritance – Polygon and Triangle ClassesContinue

  • Python

    Bank Account Class with Minimum Balance

    Byadmin September 30, 2025September 30, 2025

    Challenge Summary: Bank Account Class with Minimum Balance Objective: Create a BankAccount class that automatically assigns account numbers and enforces a minimum balance rule. 1. Custom Exception Class python class MinimumBalanceError(Exception): “””Custom exception for minimum balance violation””” pass 2. BankAccount Class Requirements Properties: Methods: __init__(self, name, initial_balance) deposit(self, amount) withdraw(self, amount) show_details(self) 3. Key Rules: 4. Testing…

    Read More Bank Account Class with Minimum BalanceContinue

  • Python

    Currency Converter

    Byadmin September 30, 2025September 30, 2025

    Challenge: Currency Converter Class with Accessors & Mutators Objective: Create a CurrencyConverter class that converts an amount from a foreign currency to your local currency, using accessor and mutator methods. 1. Class Properties (Instance Variables) 2. Class Methods 3. Task Instructions

    Read More Currency ConverterContinue

  • Python

    Customer mobile

    Byadmin September 30, 2025September 30, 2025

    Create a Customer class that uses accessor (getter) and mutator (setter) methods to control access to its properties. 1. Class Properties 2. Class Methods 3. Task Instructions

    Read More Customer mobileContinue

  • Python

     Calculator using static methods

    Byadmin September 30, 2025September 30, 2025

    Read More  Calculator using static methodsContinue

  • Python

    Employee Class using Instance & Class Variables

    Byadmin September 30, 2025September 30, 2025

    Challenge: Employee Class using Instance & Class Variables Objective: Create an Employee class that uses both instance variables and a class variable. 1. Class Properties (Variables) 2. Employee ID Rules 3. Class Methods (Functions) 4. Key Summary

    Read More Employee Class using Instance & Class VariablesContinue

  • Python

    circle,Rational Number

    Byadmin September 30, 2025September 30, 2025

    1. What is a Rational Number? A rational number is any number that can be expressed as a fraction where both the numerator and the denominator are integers (whole numbers), and the denominator is not zero. The key idea is ratio. The word “rational” comes from the word “ratio.” General Form:a / b Examples: Non-Examples: 2. Formulas for Addition and Subtraction…

    Read More circle,Rational NumberContinue

  • Python

    Generalization vs. Specialization

    Byadmin September 30, 2025September 30, 2025

    Object-Oriented Programming: Generalization vs. Specialization Introduction Inheritance in OOP serves two primary purposes: Let’s explore these concepts with clear examples. 1. Specialization (Extending Functionality) Specialization involves creating a new class that inherits all features from a parent class and then adds new, specific features. The core idea is reusability—you build upon what already exists. Key Principle: Child Class =…

    Read More Generalization vs. SpecializationContinue

Page navigation

Previous PagePrevious 1 2 3 4 5 … 19 Next PageNext

© 2025 Learn Python - WordPress Theme by Kadence WP

Scroll to top
  • Python
  • Cyber Security Basics