Session One
Session One
Intro
• What is Programming: Instructions have given to machine to do
some tasks using Programming languages.
•.
• Programming languages: It is a way of communication that humans
understand because it is close to human language converted inside
the machine into 0 , 1
Types of Programming languages
Low level , High level
Interpreted , Compiled
Programming ,Scripted
Open source , not open source
Support OOP , not supporting OOP
What’s Python?
• Python has a simple, easy to learn syntax, which emphasizes
readability. Applications written in Python can run on almost any
computer, including those running Windows, macOS, and popular
distributions of Linux. Furthermore, the ecosystem contains a rich
set of development tools for writing, debugging, and publishing
Python applications.
• PyCharm
• https://www.jetbrains.com/pycharm/download/#section=windows
• OR->>> Anaconda
• https://www.anaconda.com/products/distribution/start-coding-
immediately
Interactive Programming
•>>> print(“Hello world!”)
•Hello world!
• Python as Calculator
>>> 5+5
10
>>> 10.5-2*3
4.5
>>> 10**2
>>> a=3
>>> a
>>> b=a
>>> b
>>> b=b+3
>>> b
Data Types: Number Types
>>> 17/5
>>> (2+1j)**2
(3+4j)
>>> float(17)/5
Boolean
• type is one of the built-in data types provided by Python, which
represents one of the two values .(True or False).
Data Types: Strings
• Single quote:
>>> ’atg’
’atg’
• Double quote:
>>> ”atg”
’atg’
Invalid Syntax
>>> ” This is a codon, isn’t it?” # Or >>> ’This is a codon, isn\’t it?’
’atgatgatg’
True
False
Input and Output Formatting
• You can refer to variables or expressions in a string using f
year = 2016
event = 'Referendum'
Results of the {year} {event}
str= 'Results of the {year} {event}'
Results of the 2016 Referendum
print(str)
str= f'Results of the {year} {event}'
print(str)
Type Conversions
Function Description