PYTHON PROGRAMMING STUDY NOTES
Large Print Edition for Mechanical Engineering Students
Unit 1: Core Features of Python
Python is a high-level, versatile programming language renowned for its simplicity,
readability, and wide range of applications. It is widely used in web development, data
science, artificial intelligence, and engineering automation.
Key Features:
• Easy to Learn: Simple syntax perfect for beginners.
• Interpreted: Code is executed line-by-line without pre-compilation.
• High-Level: Abstracted from hardware complexities.
• Object-Oriented: Fully supports classes, objects, and inheritance.
• Platform Independent: Runs on Windows, Linux, and macOS seamlessly.
• Open Source: Free to download, use, and modify.
• Dynamically Typed: No explicit variable type declarations required.
• Large Standard Library: Built-in modules for file and web tasks.
Applications in Automation & Engineering
In Automation:
1. File Handling: Automatically rename, move, or copy files.
2. Notifications: Programmatically dispatch emails and alerts.
3. Web Automation: Form filling, web scraping, and automated tasks.
In Engineering:
1. Calculations: Fast mathematical analysis and solving formulae.
2. Robotics & IoT: Direct sensor interfacing and machine control algorithms.
3. Simulations: Virtual stress, fluid, or thermodynamic testing.
Python Syntax Rules & Variables
• Indentation: Python uses uniform whitespace blocks instead of curly braces.
• Case-Sensitive: Lowercase and uppercase identifiers are completely distinct.
• Variables: Named pointers to data, assigned dynamically via the '=' operator.
Practical Engineering Code Examples
Example 1: Temperature Unit Converter
celsius = float(input('Enter Celsius: '))
fahrenheit = (celsius * 9/5) + 32
print('Fahrenheit =', fahrenheit)
Example 2: Core Loop Structure
num = int(input('Enter number: '))
for i in range(1, 11):
print(num, 'x', i, '=', num * i)