Posts

Showing posts from September, 2022

Variable & Data Types (Session 3)

 Variable: A variable is a name given to a memory location in a program.  Variables do not need to be declared with any particular  type , and can even change type after they have been set. For example: a = 28 b =21.26 c ="Mustajab" In short, we can say that here variable is a container to store a value . Example: x = 28 y =  "Mustajab" print (x) print (y) Here Mustajab is str type and 28 is int type. Many Values to Multiple Variables: Python allows us to assign values to multiple variables in one line: x, y, z =  "Student1" ,  "Student2" ,  "Student3" print (x) print (y) print (z) Rules for defining a variable name:  A variable name can contain alphabets, digits, and underscore. A variable name can only start with an alphabet and underscore. A variable can’t start with a digit. No white space is allowed to be used inside a variable name. Task : Read about Whitespace Characters in Python. Data Type: Python is a great language that...

Modules, Comments & Pip (Session-2)

  Modules: A module is a file containing code written by somebody else (usually) which can be imported and used in our programs. Types of Modules: There are two types of modules in Python: Built-in modules – Pre-installed in Python External modules – Need to install using pip Pip: Pip is a package manager for python. You can use pip to install a module on your system. E.g., pip install flask (It will install flask module in your system). Comments: Comments are used to write something which the programmer does not want to execute. Comments can be used to mark the author's name, date, etc. Types of Comments: There are two types of comments in python, Single line comments – Written using # (pound/hash symbol) Multi-line comments – Written using ‘’’ Comment ‘’’ or “”” Comment “”” . REPL:  REPL stands for Read Evaluation Print Loop .  We can use python as a calculator by typing “python” +  TO DO  on the terminal. Now create a file: hello.py and paste the below cod...

Python Basics (Introduction)

Image
What is Programming? Just like we use Urdu or English and other languages to communicate with each other, we use a Programming language to communicate with the computer. Programming is a way to instruct the computer to perform various tasks. What is Python: Python is a simple and easy-to-understand language that feels like reading simple English.  It works on Pseudo code nature which makes it easy to learn and understandable for beginners. Features: Easy to understand = Less development time Free and open source High-level language Portable – works on Windows/Linux/Mac Syntax: The syntax of the Python programming language is  the set of rules which defines how a Python program will be written.  Python is a friendly language. It has a simple and easy-to-learn syntax. Moreover, its features are easy to use, which allows you to write short and readable code. While,  C++ is a bit complex when it comes to the simplicity of language, and it has more syntax rules. What is P...

Python Installation

Image
  How to Install Python on Windows 10 We can install Python in these simple steps: Download the binaries. Run the executable installer. Add python to PATH environmental variables. Step 1: Download the Python Installer binaries: Open the  official Python website  in your web browser.You can choose the version of Python you wish to install. It is recommended to install the latest version of Python. Click on the link to download  Windows x86 executable installer  if you are using a 32-bit installer. In case your Windows installation is a 64-bit system, then download  Windows x86-64 executable installer . Step 2: Run the Executable Installer: Once the installer is downloaded, run the Python installer. Check the  Install launcher for all users  check box. Further, you may check the  Add Python 3.7 to path  check box to include the interpreter in the execution path. Follow the following steps for further installation.    4. Click on...