0% found this document useful (0 votes)
18 views

Python Programming Fundamentals

This document provides an overview of Python programming fundamentals including Python character sets, tokens, keywords, identifiers, literals, strings, numeric literals, the None literal, complex data types, variables and identifiers, input/output, operators, expressions, statements, comments, and the math module. It discusses Python syntax elements such as multiline strings, floor division, relational and logical operators, assignment operators, and operator precedence. It also covers variable naming rules, dynamic typing, determining a variable's type and value, and avoiding errors when working with variables.

Uploaded by

poyed11064
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Python Programming Fundamentals

This document provides an overview of Python programming fundamentals including Python character sets, tokens, keywords, identifiers, literals, strings, numeric literals, the None literal, complex data types, variables and identifiers, input/output, operators, expressions, statements, comments, and the math module. It discusses Python syntax elements such as multiline strings, floor division, relational and logical operators, assignment operators, and operator precedence. It also covers variable naming rules, dynamic typing, determining a variable's type and value, and avoiding errors when working with variables.

Uploaded by

poyed11064
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

PYTHON PROGRAMMING

FUNDAMENTALS
CHAPTER -4
PYTHON CHARACTER SET
TOKENS
KEYWORDS
Identifiers
LITERALS
STRING
STRING TYPE IN PYTHON

Multiline String
Sometimes we next text across multiple line. So we can insert it
by using triple quotes (‘ ‘ ‘ and end with’ ’ ’ )
Example of Multiple line
Numeric Literals

While writing large integer value,do not use comma to separate


digits .Also, Integer should not having leading zeros
Special Literal-None
Complex data type
Variable/ Identifier

 Variables are containers for storing data values.


 Unlike other programming languages, Python has no command for
declaring a variable.
 A variable is created the moment you first assign a value to it.
 Variables do not need to be declared with any particular type and can
even change type after they have been set.
Variable Names

 A variable can have a short name (like x and y) or a more


descriptive name (age, carname, total_volume).
Rules for Python variables:
 A variable name must start with a letter or the underscore
character
 A variable name cannot start with a number
 A variable name can only contain alpha-numeric
characters and underscores (A-z, 0-9, and _ )
 Variable names are case-sensitive (age, Age and AGE are
three different variables)
Lvalue and Rvalue Of Variable
Lvalue and Rvalue
Multiple Assignments
Example
Just a minute
Variable Definition
Dynamic Typing
Caution with Dynamic Typing
Determining the type of variable
Value Of an Variable
Id Of an Variable
Just a minute
Complex data type
Input
Reading numeric values
To find sum of two numbers
Possible errors
Possible Errors
eval ()

 This Function is used to evaluate the value of string as


number and returns the numeric result.
 If the given argument is not a number ,it returns an error
Just a minute
Operators
Types Of Operators
Types Of Operators- Arithematic
Just a minute
Floor Division
Just a minute
Relational Operators
Logical Operators
Assignment Operator
Punctuators
Expression
Statement
CHAINED EXPRESSION
Comments
Concatenating String
Precedence of Arithmetic and logical
Operators

 () [parenthesis]
 **[Exponentiation]
 -(negation)
 /(division) //(floor division) ,*(multiplication) ,%(modulus)
 +(addition ),-(subtraction)
 Logical operators ( not ,and ,or)
Example

12 * ( 3%4) //2 + 6


12 * 3//2 + 6
36//2 + 6
18 +6
24
Just a minute

12+ ( 3 **4-6 )/2


12%3 ** 4//5 +6
12+3 * (4-6)/2
Multiple ( * * operator)
String Comparison
Math Module in PYTHON
Using pi
Just a minute

You might also like