A Brief Introduction to Python - English

DevashishNegi6 36 views 22 slides Aug 18, 2024
Slide 1
Slide 1 of 22
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22

About This Presentation

This is a slide for Basic Introduction to Python


Slide Content

Introduction to Python Language

Versatile High-Level Language Widely used in web development , data analysis , AI , and more. Origins Created by Guido van Rossum in 1991.Maintained by the Python Software Foundation. Emphasis on Readability Enables developers to write clean and understandable code. Efficiency Allows expressing concepts in fewer lines of code. OVERVIEW

Key Features

Installing a Python Interpreter Interpreter is needed to execute Python programs Windows Download Python from python.org Comes with IDLE, an Integrated Development Environment suitable for beginners . Linux Most distributions come with Python preinstalled . Check version by typing python3 in the terminal . macOS Typically includes Python 2.7 by default . Download Python 3 from python.org for the latest features and compatibility. Online Interpreters For quick experiments and learning, use online interpreters like GeeksforGeeks IDE .

First Python Program print ( "Hello, Python World!" ) print() is a built-in function , used to display messages or results on the console output 

Evolution of Python

Popularity of Python

Prerequisites of Learning Python

Python vs Java Features Python Java Typing Dynamically Typed Statically Typed Syntax Concise, Uses indentation Verbose, uses braces Flexibility Flexible and easy to modify Strict and rigid structure Usage Ideal for scripting and rapid prototyping Ideal for large scale applications

Python vs Java Codes: Python print ("Hello, world!") Java public class HelloWorld { public static void main (String[] args ) { System.out.println ("Hello, world!"); } }

Applications of Python

Organizations using Python

Getting Started Basic Python Code:

Variables in Python Dynamic Typing No need for explicit variable declarations. Type is determined by the value assigned. Naming Conventions Variable names should be descriptive . Use underscores to separate words (e.g., my_variable ). Assignment Use the = operator to assign values. Multiple assignments are possible (e.g., x, y = 5, 10).

Comments in Python Single-line comment use # Multi-line comment use “”” your comment “””

User Input Normal Input: name = input ("Enter your name: ") print( f"Hello , {name}!") Inputs with Conversion: num1 = int ( input ("Enter the first number: ")) num2 = int ( input ("Enter the second number: ")) product = num1 * num2 print( f"The product is: {product}")

Conditional Statements if-else age = 18 if age >= 18: print("You are an adult.") els e: print("You are a minor.")

Functions Functions in Python allow you to encapsulate code for reuse and better organization . ex. def greet(name): print( f"Hello , {name}!")   greet("Python")

Loops Loops are used to execute a block of code repeatedly . For Loop for i in range (5): print( i ) # Output: 0, 1, 2, 3, 4

Modules and Libraries Python’s standard library provides a wealth of modules for various tasks . Example: Importing a Module # Using the math module import math   result = math.sqrt (25) print(result) # Output: 5.0

Thank You