Coding_Bootcamp_Day_1
Coding_Bootcamp_Day_1
Time Breakdown:
- Concept learning: 45 minutes.
- Challenges: 50 minutes.
- Feedback: 10 minutes.
Where to Write Python Code
- You can use any **online editor** to write and run Python code.
- Suggested online tools:
- Online GDB (https://www.onlinegdb.com/)
- Replit (https://replit.com/)
- If you already have Python installed with standard editors like:
- PyCharm
- VS Code
- Jupyter Notebook
That’s great but **not mandatory**.
Use what works best for you to practice and execute code.
Structure of a Python Program
• Key Elements:
• - Comments: Explain code using #.
• - Imports: Add optional modules or libraries (import math).
• - Variables: Declare and store data (num1 = 5).
• - Input/Output:
• - Input: input("Enter a number: ").
• - Output: print("Hello, World!").
• - Main Logic: The sequence of executable steps.
• Example Code:
• # A sample Python program
• num1 = int(input("Enter a number: "))
• print("You entered:", num1)
Basics of Display and Data Types
• Output Display: Using print() for:
• - Numbers: print(42)
• - Strings: print("Hello")
• - Floats: print(3.14)
• Basic Operators:
• - Arithmetic: +, -, *, /, **.
Challenge 1 – Sum and Average
• Problem Statement:
• - Input three numbers.
• - Calculate and display their sum and average.
• Example Inputs/Outputs:
• - Input: 3, 5, 7.
• - Output: Sum = 15, Average = 5.0.
• Hints:
• - Use input() for taking user values.
• - Perform addition and division for results.
Challenge 2 – Simple Interest
Calculator
• Problem Statement:
• - Input: Principal, time, and rate of interest.
• - Compute simple interest using the formula: SI = (P × T × R) / 100.
• - Display the result.
• Example Inputs/Outputs:
• - Input: P = 1000, T = 2, R = 5.
• - Output: SI = 100.
• Hints:
• - Break down the formula into steps.
Challenge 3 – Sales and Discount
Calculator
• Problem Statement:
• - Input:
• - Item name, unit price, quantity, and percentage discount.
• - Calculate:
• - Total value of the sale.
• - Discount amount.
• - Final selling price.
• - Display the results.
• Example:
• - Input: Item: "Laptop", Price: 50000, Quantity: 2, Discount: 10%.
• - Output: Total: 100000, Discount: 10000, Final: 90000.
Challenge 4 – Swapping Numbers
• Problem Statement:
• - Swap two numbers using:
• - A temporary variable.
• - Without a temporary variable.
• Example:
• - Input: a = 3, b = 5.
• - Output: a = 5, b = 3.
• Hints:
• - Temporary variable: temp = a.
• - Without temporary variable: Use addition/subtraction or XOR.
Farmer’s Problem – Comprehensive
Challenge
• Problem Statement:
• - A real-world scenario provided as a detailed document (PDF).
• Focus:
• - Requirement analysis and problem decomposition.
• - Transitioning from equations to code.
• Duration:
• - Solve the problem collaboratively in 30 minutes.
Wrap-Up and Feedback
• Key Takeaways:
• - Importance of problem-solving over syntax.
• - Focus on logic, not language details.
• - Real-world applications of coding.
• Feedback:
• - Open the floor for questions and reflections.
• - Discuss areas of improvement and next steps.