Programming Machine Cod e Translator (Compiler / Interpreter)
What is Python? Python is simple & easy Free & Open Source High Level Language Developed by Guido van Rossum Portable
Our First Program print("Hello World")
Python Character Set Letters – A to Z, a to z Digits – 0 to 9 Special Symbols - + - * / etc. Whitespaces – Blank Space, tab, carriage return, newline, formfeed Other characters – Python can process all ASCII and Unicode characters as part of data or literals
Variables A variable is a name given to a memory location in a program. name = "Sonal" age = 30 price = 25.99
Memory name = "Sonal" age = 30 price = 25.99
Rules for Identifiers
Data Types Integers String Float Boolean None
Data Types
Keywords Keywords are reserved words in python. *False should be uppercase
Print Sum
# Single Line Comment """ Multi Line Comment """ Comments in Python
Types of Operators An operator is a symbol that performs a certain operation between operands. Arithmetic Operators ( + , - , * , / , % , ** ) Relational / Comparison Operators ( == , != , > , < , >= , <= ) Assignment Operators ( = , +=, -= , *= , /= , %= , **= )
Type Conversion a, b = 1, 2.0 sum = a + b #error a, b = 1, "2" sum = a + b
Type Casting a, b = 1, "2" c = int(b) sum = a + c
Type Casting
Input in Python input( ) #result for input( ) is always a str int ( input( ) ) #int float ( input( ) ) #float give code eg of all 3 input( ) statement is used to accept values (using keyboard) from user
Let‘s Practice Write a Program to input 2 numbers & print their sum. WAP to input side of a square & print its area WAP to input 2 floating point numbers & print their average WAP to input 2 int numbers, a and b. Print True if a is greater than or equal to b. If not print False.
Let‘s Practice WAP to input side of a square & print its area.
Let‘s Practice WAP to input 2 floating point numbers & print their average.
Let‘s Practice WAP to input 2 int numbers, a and b. Print True if a is greater than or equal to b. If not print False.

Lecture1_about python introduction variables