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

Day 1-Python

Today's agenda covers an introduction to Python including Python variables, data types, casting, and operators. Python was created by Guido van Rossum in 1991 and relies on indentation rather than curly braces. Variables are created when a value is first assigned and variable names must start with a letter or underscore, cannot start with a number, and can only include alphanumeric characters and underscores. Data types determine what operations variables can perform and casting allows converting between types like integers, floats, and strings. Operators in Python include arithmetic, assignment, comparison, logical, identity, membership, and bitwise operators.

Uploaded by

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

Day 1-Python

Today's agenda covers an introduction to Python including Python variables, data types, casting, and operators. Python was created by Guido van Rossum in 1991 and relies on indentation rather than curly braces. Variables are created when a value is first assigned and variable names must start with a letter or underscore, cannot start with a number, and can only include alphanumeric characters and underscores. Data types determine what operations variables can perform and casting allows converting between types like integers, floats, and strings. Operators in Python include arithmetic, assignment, comparison, logical, identity, membership, and bitwise operators.

Uploaded by

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

Day 1

Today’s agenda:
- Introduction to Python
- Python variables
- Data types
- Casting
- Operators
Python- overview
❏ It was created by Guido van Rossum, and released in 1991
❏ Shorter codes, ease of writing
❏ Relies on indentation, instead of curly braces
❏ Inbuilt functions
❏ Dynamically typed
Variables
Python has no command for declaring a variable.

A variable is created the moment you first assign a value to it.

Eg: a=1
Variable names
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)
A variable name cannot be any of the Python keywords
Assign multiple values
x, y, z = "Orange", "Banana", "Cherry"

One Value to Multiple Variables


x = y = z = "Orange"
Data Types
Variables can store data of different types, and different types can do different
things.
Casting
int() - constructs an integer number from an integer literal, a float literal (by
removing all decimals), or a string literal (providing the string represents a whole
number)
float() - constructs a float number from an integer literal, a float literal or a string
literal (providing the string represents a float or an integer)
str() - constructs a string from a wide variety of data types, including strings,
integer literals and float literals
operators
Arithmetic operators
Assignment operators
Comparison operators
Logical operators
Identity operators
Membership operators
Bitwise operators
Arithmetic Operators
Assignment Operators
Comparison Operators
Logical Operators
Identity Operators
Membership Operators
Bitwise Operators

You might also like