KEMBAR78
Python: Strings & Intro Programming PDFs | PDF
PYTHON
Bikram Nath
Department of Computer Science
New Alipore College
Programming
Introduction
Source Program Machine Language
Compiler
Source Program Output
Interpreter
Output
Intermediate Code
COMPILER
A compiler is a special program that processes statements written in a
particular language and turns them into machine language.
INTERPRETER
An interpreter is a program that translates a programming language
into a comprehensible language
Source to Output
 One of the most widely used User-Friendly programming languages.
 Easy To Learn programming language.
 Python is a High Level language.
 It is a Free and Open Source language.
 Python is portable and platform independent, means it can run on
various operating systems and hardware platforms.
 Python has a Rich Library of Predefined Functions.
Most Application Area
 Machine learning
 Artificial intelligence
 Big Data
 GUI based desktop applications
 Robotics
Why Python ?
Where to Write Python Code ?
1) Interactive mode :
 Writing a python statement on the >>> prompt directly.
 In shell we can run only one command at a time
2) Script mode :
Writing a Python program in a file (“.py” extension), save it and then
use the interpreter to execute it.
When we Run our program, the output will display at shell
Output in python
Program Code Output
Variables IN Python
It is an object or an item or element that is stored in the memory.
Value of a variable can be a string, numeric or any combination of
alphanumeric characters.
Input in python
String input: Str = input(“Enter a string : ”)
Integer input: Val = int( input(“Enter a number : “) )
Float Input: num = float( input(“Enter a float : “) )
A keyword is a word having special meaning reserved by python
programming language
False async del from lambda return
None await elif global nonlocal try
True break else if not while
and class except import or with
as continue finally in pass yield
assert def for is raise
Python Keywords
Python Data Types
Arithmetic Operator
+ (Addition), - (Subtraction), * (Multiplication),
/ (Division), //(Floor Division), %(Remainder),
**(Power)
Relational Operator
> (Greater Than), < (Less Than),
>= (Greater Than or Equal), <= (Less Than or Equal),
== (Equality), != (Not Equality)
Assignment Operator =, +=, -=, *=, /=, //=, %=, **=
Logical Operator and or not
Identity Operator is is not
Membership Operator in not in
Python Operators
MATHEMATICAL OPERATORS IN PYTHON
Addition(+), Subtraction(-), Multiplication(*), Division(/), Modulus(%),
Power of Exponent (**), Rounding off (//)
Built In Functions IN Python
There are some functions in Python which help us to reduce program lines
and effort. Some of the Built-in functions are -
Comment line is usually written in English word to express what the program
or part of a program does.
o It is not a part of code.
o It is used to understand the code easily.
o Compiler does not compile a comment line.
Single line comment : ( # )
Multiline comment : (‘’’ …. ‘’’) or (“”” ….. “””)
* Actually these comment line used in python module
Comment Line IN Python
Thank You

Python: Strings & Intro Programming PDFs

  • 1.
    PYTHON Bikram Nath Department ofComputer Science New Alipore College Programming Introduction
  • 2.
    Source Program MachineLanguage Compiler Source Program Output Interpreter Output Intermediate Code COMPILER A compiler is a special program that processes statements written in a particular language and turns them into machine language. INTERPRETER An interpreter is a program that translates a programming language into a comprehensible language Source to Output
  • 3.
     One ofthe most widely used User-Friendly programming languages.  Easy To Learn programming language.  Python is a High Level language.  It is a Free and Open Source language.  Python is portable and platform independent, means it can run on various operating systems and hardware platforms.  Python has a Rich Library of Predefined Functions. Most Application Area  Machine learning  Artificial intelligence  Big Data  GUI based desktop applications  Robotics Why Python ?
  • 4.
    Where to WritePython Code ? 1) Interactive mode :  Writing a python statement on the >>> prompt directly.  In shell we can run only one command at a time 2) Script mode : Writing a Python program in a file (“.py” extension), save it and then use the interpreter to execute it. When we Run our program, the output will display at shell
  • 5.
  • 6.
    Variables IN Python Itis an object or an item or element that is stored in the memory. Value of a variable can be a string, numeric or any combination of alphanumeric characters.
  • 7.
    Input in python Stringinput: Str = input(“Enter a string : ”) Integer input: Val = int( input(“Enter a number : “) ) Float Input: num = float( input(“Enter a float : “) )
  • 8.
    A keyword isa word having special meaning reserved by python programming language False async del from lambda return None await elif global nonlocal try True break else if not while and class except import or with as continue finally in pass yield assert def for is raise Python Keywords
  • 9.
  • 10.
    Arithmetic Operator + (Addition),- (Subtraction), * (Multiplication), / (Division), //(Floor Division), %(Remainder), **(Power) Relational Operator > (Greater Than), < (Less Than), >= (Greater Than or Equal), <= (Less Than or Equal), == (Equality), != (Not Equality) Assignment Operator =, +=, -=, *=, /=, //=, %=, **= Logical Operator and or not Identity Operator is is not Membership Operator in not in Python Operators
  • 11.
    MATHEMATICAL OPERATORS INPYTHON Addition(+), Subtraction(-), Multiplication(*), Division(/), Modulus(%), Power of Exponent (**), Rounding off (//)
  • 14.
    Built In FunctionsIN Python There are some functions in Python which help us to reduce program lines and effort. Some of the Built-in functions are -
  • 15.
    Comment line isusually written in English word to express what the program or part of a program does. o It is not a part of code. o It is used to understand the code easily. o Compiler does not compile a comment line. Single line comment : ( # ) Multiline comment : (‘’’ …. ‘’’) or (“”” ….. “””) * Actually these comment line used in python module Comment Line IN Python
  • 16.