We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16
1.
Basics Of Python Python is a high-level, dynamically typed multiparadigm programming language
Which is known for its simplicity and readability.
Used for web development, data science,
automation, artificial intelligence, etc.
It emphasizes code readability and allows
developers to express concepts in fewer lines of code. Fundamental Types
• Integers :-Integer are created by any number without a decimal
or complex component.
Example :- 1, 2, 3…..
• Floats :- Float can be created by adding a decimal component
to a number.
Example :- 1.234, 8.765 …..
• Boolean :- Boolean can be defined by typing True/False without quotes
Example :- True, False
• Strains :- String literals can be defined with any of single
quotes ('), double quotes (").
Example :- “hi” , ‘hello’……
• Complex :- Complex literals can be created by using the notation x + yj where x is the real component and y is the imaginary component.
Example :- 1.0-2.0j, 3+7j
Variables Variables :- variables are used to store values that can be referenced and manipulated in a program. A variable is essentially a name that points to a value stored in memory.
Variable Naming Rules:-
• The name must begin with a letter (a-z, A-Z) or an underscore (_). • The rest of the name can include letters, numbers (0-9), and underscores. • Python is case-sensitive, meaning variable, Variable, and VARIABLE are all different. • You cannot use Python keywords (reserved words) as variable names (e.g., if, else, for, True, None). Examples of valid variable names:
• Strings (str): Text data enclosed in quotes (single or double).
Example - name = "Alice“ greeting = 'Hello, World!' • Booleans (bool): Represents True or False values. Example - is_active = True is_logged_in = False Branching Statements
Branching statements :- allow your program to make decisions and
execute different sections of code based on certain conditions.
The primary branching statements in Python are:
1.if statement 2.if-else statement 3.if-elif-else statement 1. if Statement The simplest form of a branching statement, where a block of code is executed only if a specified condition is True. 2. if-else Statement The if-else statement provides an alternative action if the condition is False. If the condition is True, the code in the if block runs; if it is False, the code in the else block runs. 3. if-elif-else Statement The if-elif-else statement allows you to check multiple conditions. The first if condition is evaluated; if it's False, the elif conditions are checked in order. If none of the if or elif conditions are True, the else block is executed List list is a built-in data structure used to store multiple items in a single variable. A list can contain elements of different data types, such as integers, strings, and other lists.