Python Notes for AWS and Cloud Computing (English and Hindi)
1. Python Basics (English)
- Variables: Used to store data. Example:
x = 10
name = "Cloud"
- Data Types: int, float, string, list, tuple, dict.
Example:
my_list = [1, 2, 3]
my_dict = {"key": "value"}
- Loops: Repeat a block of code.
for i in range(5): print(i)
- Conditional Statements: Used for decision making.
Example:
if x > 5:
print("Greater than 5")
1. Python Basics (Hindi)
- Variables: Data ko store karne ke liye use hota hai. Udaharan:
x = 10
name = "Cloud"
- Data Types: int, float, string, list, tuple, dict.
Udaharan:
my_list = [1, 2, 3]
my_dict = {"key": "value"}
- Loops: Ek code block ko baar-baar repeat karta hai.
for i in range(5): print(i)
- Conditional Statements: Faisla lene ke liye use hota hai.
if x > 5:
print("Greater than 5")
2. Functions (English)
- Functions: Group code for reuse. Example:
def greet(name):
return f"Hello, {name}!"
print(greet("AWS"))
2. Functions (Hindi)
- Functions: Code ko reuse karne ke liye group karta hai. Udaharan:
def greet(name):
return f"Hello, {name}!"
print(greet("AWS"))
3. File Handling (English)
- Read and write files. Example:
with open("example.txt", "w") as f:
f.write("Hello Cloud")
with open("example.txt", "r") as f:
print(f.read())
3. File Handling (Hindi)
- File padhe aur likhein. Udaharan:
with open("example.txt", "w") as f:
f.write("Hello Cloud")
with open("example.txt", "r") as f:
print(f.read())
4. JSON Handling (English)
- Parse and handle JSON data. Example:
import json
data = '{"key": "value"}'
parsed = json.loads(data)
print(parsed['key'])
4. JSON Handling (Hindi)
- JSON data ko parse karein aur handle karein. Udaharan:
import json
data = '{"key": "value"}'
parsed = json.loads(data)
print(parsed['key'])
5. Boto3 Library (English)
- Automate AWS resources. Example:
import boto3
s3 = boto3.client('s3')
s3.upload_file('example.txt', 'my-bucket', 'example.txt')
5. Boto3 Library (Hindi)
- AWS resources automate karein. Udaharan:
import boto3
s3 = boto3.client('s3')
s3.upload_file('example.txt', 'my-bucket', 'example.txt')
6. Error Handling (English)
- Handle errors gracefully. Example:
try:
x = 10 / 0
except ZeroDivisionError:
print("Cannot divide by zero!")
6. Error Handling (Hindi)
- Errors ko handle karein. Udaharan:
try:
x = 10 / 0
except ZeroDivisionError:
print("Cannot divide by zero!")
7. Logging (English)
- Log script outputs. Example:
import logging
logging.basicConfig(level=logging.INFO)
logging.info("This is an info message")
7. Logging (Hindi)
- Script ke outputs log karein. Udaharan:
import logging
logging.basicConfig(level=logging.INFO)
logging.info("This is an info message")
8. Useful Modules (English)
- OS Module: Interact with the operating system.
import os
print(os.getcwd())
- Requests Module: Work with APIs.
import requests
response = requests.get('https://api.example.com')
print(response.json())
8. Useful Modules (Hindi)
- OS Module: Operating system ke saath interact karein.
import os
print(os.getcwd())
- Requests Module: APIs ke saath kaam karein.
import requests
response = requests.get('https://api.example.com')
print(response.json())