Python Syntax
Python Syntax
Python Syntax
Dr. Rajiv Pandey,
Senior Member IEEE
Amity University Uttar Pradesh,
Lucknow Campus,
Amity Institute of Information Technology
2
Amity Institute of Information Technology
3
Amity Institute of Information Technology
4
Amity Institute of Information Technology
5
Amity Institute of Information Technology
6
Amity Institute of Information Technology
Indentation Rules
• Use the colon : to start a block and press
Enter.
• All the lines in a block must use the same
indentation, either space or a tab.
• Python recommends four spaces as
indentation to make the code more readable.
Do not mix space and tab in the same block.
• A block can have inner blocks with next level
indentation.
7
Amity Institute of Information Technology
8
Amity Institute of Information Technology
• def SayHello(name):
• print("Hello ", name)
• print("Welcome to Python Tutorials")
9
Amity Institute of Information Technology
Display Output
12
Amity Institute of Information Technology
13
Amity Institute of Information Technology
14
Amity Institute of Information Technology
15
Amity Institute of Information Technology
16
Amity Institute of Information Technology
• Age = Int(age)
17
Amity Institute of Information Technology
Reference
• Chapter 4 - Introduction to Problem Solving – NCERT, https://ncert.nic.in
• https://www.geeksforgeeks.org/difference-between-bottom-up-model-and-top-down-m
odel/
• https://gawron.sdsu.edu/python_for_ss/course_core/book_draft/anatomy/import_state
ments.html
• https://www.tutorialspoint.com/python/index.htm.
• https://www.tutorialsteacher.com/python/python-interective-shell
• https://www.tutorialsteacher.com/python/python-syntax
19