|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "- Installing Python:\n", |
| 8 | + " - Windows: Download from python.org, run the installer, and ensure you add Python to your PATH.\n", |
| 9 | + " - Mac: Use Homebrew or download from python.org.\n", |
| 10 | + " - \n", |
| 11 | + "- Development Environment:\n", |
| 12 | + " - IDLE: Comes with Python, great for beginners.\n", |
| 13 | + " - PyCharm/VSCode: Powerful editors with additional features\n", |
| 14 | + "\n", |
| 15 | + " Lets write our first python program:" |
| 16 | + ] |
| 17 | + }, |
| 18 | + { |
| 19 | + "cell_type": "code", |
| 20 | + "execution_count": null, |
| 21 | + "metadata": {}, |
| 22 | + "outputs": [], |
| 23 | + "source": [] |
| 24 | + }, |
| 25 | + { |
| 26 | + "cell_type": "code", |
| 27 | + "execution_count": null, |
| 28 | + "metadata": { |
| 29 | + "editable": true, |
| 30 | + "slideshow": { |
| 31 | + "slide_type": "" |
| 32 | + }, |
| 33 | + "tags": [], |
| 34 | + "trusted": true |
| 35 | + }, |
| 36 | + "outputs": [], |
| 37 | + "source": [ |
| 38 | + "print(\"Hello, World!\")" |
| 39 | + ] |
| 40 | + }, |
| 41 | + { |
| 42 | + "cell_type": "markdown", |
| 43 | + "metadata": {}, |
| 44 | + "source": [ |
| 45 | + "Basic Concepts\n", |
| 46 | + "- Syntax: The rules that define the structure of Python code.\n", |
| 47 | + "- Comments: Notes in your code to explain what it does. In Python, use # for single-line comments." |
| 48 | + ] |
| 49 | + }, |
| 50 | + { |
| 51 | + "cell_type": "code", |
| 52 | + "execution_count": null, |
| 53 | + "metadata": { |
| 54 | + "trusted": true |
| 55 | + }, |
| 56 | + "outputs": [], |
| 57 | + "source": [ |
| 58 | + " # This is a comment" |
| 59 | + ] |
| 60 | + }, |
| 61 | + { |
| 62 | + "cell_type": "markdown", |
| 63 | + "metadata": {}, |
| 64 | + "source": [ |
| 65 | + "Exercises:\n", |
| 66 | + "1. Install Python and run a simple program that prints your name.\n", |
| 67 | + "2. Write a comment in your code explaining what it does." |
| 68 | + ] |
| 69 | + }, |
| 70 | + { |
| 71 | + "cell_type": "markdown", |
| 72 | + "metadata": {}, |
| 73 | + "source": [ |
| 74 | + "Numbers and Arithmetic Operations\n", |
| 75 | + "- Integers: Whole numbers, e.g., 1, 2, 3.\n", |
| 76 | + "- Floats: Numbers with decimal points, e.g., 1.5, 2.7.\n", |
| 77 | + "- Arithmetic Operations:\n", |
| 78 | + " - Addition: +\n", |
| 79 | + " - Subtraction: -\n", |
| 80 | + " - Multiplication: *\n", |
| 81 | + " - Division: /\n", |
| 82 | + " - Exponentiation: **\n", |
| 83 | + " - Modulus: %" |
| 84 | + ] |
| 85 | + }, |
| 86 | + { |
| 87 | + "cell_type": "markdown", |
| 88 | + "metadata": {}, |
| 89 | + "source": [ |
| 90 | + "Strings\n", |
| 91 | + "- Creating Strings:" |
| 92 | + ] |
| 93 | + }, |
| 94 | + { |
| 95 | + "cell_type": "code", |
| 96 | + "execution_count": null, |
| 97 | + "metadata": { |
| 98 | + "trusted": true |
| 99 | + }, |
| 100 | + "outputs": [], |
| 101 | + "source": [ |
| 102 | + "my_string = \"Hello\"" |
| 103 | + ] |
| 104 | + }, |
| 105 | + { |
| 106 | + "cell_type": "markdown", |
| 107 | + "metadata": {}, |
| 108 | + "source": [ |
| 109 | + "- Manipulating Strings:" |
| 110 | + ] |
| 111 | + }, |
| 112 | + { |
| 113 | + "cell_type": "code", |
| 114 | + "execution_count": null, |
| 115 | + "metadata": { |
| 116 | + "trusted": true |
| 117 | + }, |
| 118 | + "outputs": [], |
| 119 | + "source": [ |
| 120 | + " upper_string = my_string.upper() # Converts to uppercase" |
| 121 | + ] |
| 122 | + }, |
| 123 | + { |
| 124 | + "cell_type": "markdown", |
| 125 | + "metadata": {}, |
| 126 | + "source": [ |
| 127 | + "Variables:\n", |
| 128 | + "Naming Conventions: Use descriptive names (e.g., total_cost, user_name)." |
| 129 | + ] |
| 130 | + }, |
| 131 | + { |
| 132 | + "cell_type": "code", |
| 133 | + "execution_count": null, |
| 134 | + "metadata": { |
| 135 | + "trusted": true |
| 136 | + }, |
| 137 | + "outputs": [], |
| 138 | + "source": [ |
| 139 | + " age = 25" |
| 140 | + ] |
| 141 | + }, |
| 142 | + { |
| 143 | + "cell_type": "markdown", |
| 144 | + "metadata": {}, |
| 145 | + "source": [ |
| 146 | + "Exercises:\n", |
| 147 | + "1. Perform arithmetic operations and print the results.\n", |
| 148 | + "2. Create a string variable, manipulate it (e.g., convert to uppercase), and print it." |
| 149 | + ] |
| 150 | + }, |
| 151 | + { |
| 152 | + "cell_type": "markdown", |
| 153 | + "metadata": {}, |
| 154 | + "source": [ |
| 155 | + "Conditional Statements*\n", |
| 156 | + "- if, else:" |
| 157 | + ] |
| 158 | + }, |
| 159 | + { |
| 160 | + "cell_type": "code", |
| 161 | + "execution_count": null, |
| 162 | + "metadata": { |
| 163 | + "trusted": true |
| 164 | + }, |
| 165 | + "outputs": [], |
| 166 | + "source": [ |
| 167 | + " age = 18\n", |
| 168 | + " if age >= 18:\n", |
| 169 | + " print(\"You are an adult.\")\n", |
| 170 | + " else:\n", |
| 171 | + " print(\"You are a child.\")" |
| 172 | + ] |
| 173 | + }, |
| 174 | + { |
| 175 | + "cell_type": "markdown", |
| 176 | + "metadata": {}, |
| 177 | + "source": [ |
| 178 | + "Exercises:\n", |
| 179 | + "1. Write a program that checks if a number is positive, negative" |
| 180 | + ] |
| 181 | + } |
| 182 | + ], |
| 183 | + "metadata": { |
| 184 | + "kernelspec": { |
| 185 | + "display_name": "Python 3", |
| 186 | + "language": "python", |
| 187 | + "name": "python3" |
| 188 | + }, |
| 189 | + "language_info": { |
| 190 | + "codemirror_mode": { |
| 191 | + "name": "python", |
| 192 | + "version": 3 |
| 193 | + }, |
| 194 | + "file_extension": ".py", |
| 195 | + "mimetype": "text/x-python", |
| 196 | + "name": "python", |
| 197 | + "nbconvert_exporter": "python", |
| 198 | + "pygments_lexer": "ipython3", |
| 199 | + "version": "3.12.4" |
| 200 | + } |
| 201 | + }, |
| 202 | + "nbformat": 4, |
| 203 | + "nbformat_minor": 4 |
| 204 | +} |
0 commit comments