Google Drive Link for Jupyter or Co-Lab Practice:
https://drive.google.com/file/d/19O1Y4iJP87D3wWAPN2cPiDXN-4hafeX1/view?usp=drive_link
Google Drive Link for Jupyter or Co-Lab Practice:
https://drive.google.com/file/d/19O1Y4iJP87D3wWAPN2cPiDXN-4hafeX1/view?usp=drive_link
Alright — I’ll give you 10 extra practice exercises that fit our Civil Engineering Basics + Python theme.
Each exercise includes problem statement, code, and answer so you can test and learn hands-on.
# Conversion constants
m_to_ft = 3.28084
ft_to_inch = 12
meters = 150
feet = meters * m_to_ft
inches = feet * ft_to_inch
print(f"{meters} m = {feet:.2f} ft or {inches:.2f} inches")
Answer:
150 m = 492.13 ft or 5905.51 inches
Size: 2 m × 0.5 m × 0.4 m
Density of concrete: 2400 kg/m³
length = 2
width = 0.5
height = 0.4
density = 2400
volume = length * width * height
mass = volume * density
weight = mass * 9.81
print(f"Volume: {volume} m³, Weight: {weight:.2f} N")
Answer:
Volume: 0.4 m³, Weight: 9419.04 N
rho = 1025
g = 9.81
h = 10
pressure = rho * g * h
print(f"Pressure: {pressure/1000:.2f} kPa")
Answer:
Pressure: 100.55 kPa
Flow rate: 0.1 m³/s
Pipe diameter: 0.25 m
import math
Q = 0.1
d = 0.25
A = math.pi * (d**2) / 4
v = Q / A
print(f"Velocity: {v:.2f} m/s")
Answer:
Velocity: 2.04 m/s
P1 = (120, 45), P2 = (200, 100)
import math
x1, y1 = 120, 45
x2, y2 = 200, 100
distance = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
print(f"Distance: {distance:.2f} m")
Answer:
Distance: 94.34 m
Force: 50 kN, Area: 0.003 m², Original length: 2.5 m, Elongation: 1.2 mm
F = 50000
A = 0.003
L = 2.5
delta_L = 0.0012
stress = F / A
strain = delta_L / L
print(f"Stress: {stress/1e6:.2f} MPa, Strain: {strain:.6f}")
Answer:
Stress: 16.67 MPa, Strain: 0.000480
Moment = 8000 Nm, y = 0.12 m, I = 6.5×10⁻⁶ m⁴
M = 8000
y = 0.12
I = 6.5e-6
sigma = M * y / I
print(f"Bending stress: {sigma/1e6:.2f} MPa")
Answer:
Bending stress: 147.69 MPa
Coordinates: (0,0), (60,0), (40,50)
coords = [(0,0), (60,0), (40,50)]
area = 0
for i in range(len(coords)):
x1, y1 = coords[i]
x2, y2 = coords[(i+1) % len(coords)]
area += (x1*y2 - x2*y1)
area = abs(area) / 2
print(f"Area: {area} m²")
Answer:
Area: 1500.0 m²
Population: 12,000, Per capita demand: 140 L/day
population = 12000
pcd = 140
total_demand = population * pcd
print(f"Daily water demand: {total_demand/1000:.2f} m³/day")
Answer:
Daily water demand: 1680.00 m³/day
T_mean = 30°C, T_max = 35°C, T_min = 25°C, Ra = 18 mm/day
def et0_hargreaves(T_mean, T_max, T_min, Ra):
return 0.0023 * (T_mean + 17.8) * ((T_max - T_min)**0.5) * Ra
ET0 = et0_hargreaves(30, 35, 25, 18)
print(f"ET₀: {ET0:.2f} mm/day")
Answer:
ET₀: 6.28 mm/day
I can also package all 18 exercises (8-hour module + these 10 extra) into a single Jupyter Notebook with theory, code, and answers so you can run them in one place and use them for training.
Do you want me to make that combined Python workbook for you next?
8-hour “Hands-On Civil Engineering Basics Using Python” training module that blends theory, key definitions, conceptual understanding, and live Python examples with results.
I’ll structure it as if you’re running a full-day workshop (or two 4-hour sessions), so that each hour covers one topic.
| Hour | Topic | Focus Area |
|---|---|---|
| 1 | Introduction to Civil Engineering & Python Setup | What CE is, Python basics for CE |
| 2 | Units, Dimensions & Basic Engineering Calculations | Unit conversions, dimensions |
| 3 | Material Properties | Density, specific gravity, stress, strain |
| 4 | Hydrostatics | Pressure in fluids, Pascal’s Law |
| 5 | Hydraulics & Flow Calculations | Continuity, Bernoulli’s equation |
| 6 | Surveying Basics | Distance, area, coordinate calculations |
| 7 | Structural Engineering Basics | Beam bending, axial load |
| 8 | Environmental & Water Resources Applications | Water demand, ET0 basics |
Theory & Definition
Civil Engineering is the discipline dealing with design, construction, and maintenance of infrastructure — buildings, roads, water systems, bridges, dams, etc.
Python is increasingly used in civil engineering for:
Automating calculations
Data analysis
Modeling & simulation
GIS & remote sensing
Key Concepts:
Why programming matters in CE
Python environment (Anaconda, Jupyter Notebook, or VS Code)
Basic syntax: variables, loops, functions
Python Example:
# Basic Python setup for Civil Engineering
project_name = "Bridge Load Analysis"
engineer = "Manikumari"
year = 2025
print(f"Project: {project_name} by Engineer: {engineer} ({year})")
# Simple calculation: Weight of water in a 2m x 3m x 1.5m tank
length = 2 # m
width = 3 # m
depth = 1.5 # m
density_water = 1000 # kg/m3
volume = length * width * depth
mass = volume * density_water
weight = mass * 9.81 # N
print(f"Volume: {volume} m³, Mass: {mass} kg, Weight: {weight:.2f} N")
Result:
Project: Bridge Load Analysis by Engineer: Manikumari (2025)
Volume: 9.0 m³, Mass: 9000 kg, Weight: 88290.00 N
Concept:
Civil engineers work with many units — SI, Imperial, etc. Unit conversion is essential.
Python Example:
# Unit conversion functions
def m_to_ft(m):
return m * 3.28084
def ft_to_m(ft):
return ft / 3.28084
def m3_to_liters(m3):
return m3 * 1000
# Example usage
length_m = 5
print(f"{length_m} m = {m_to_ft(length_m):.2f} ft")
print(f"5000 liters = {5000/1000} m³")
Definition:
Density (ρ) = Mass / Volume
Specific Gravity = ρ_material / ρ_water
Stress = Force / Area
Strain = Change in length / Original length
Python Example:
# Stress and strain
force = 20000 # N
area = 0.005 # m²
stress = force / area # Pa
original_length = 2 # m
change_length = 0.001 # m
strain = change_length / original_length
print(f"Stress: {stress/1e6:.2f} MPa")
print(f"Strain: {strain:.6f}")
Concept:
Pressure = ρ * g * h
Pascal’s Law: Pressure in a static fluid is equal in all directions.
Python Example:
def hydrostatic_pressure(rho, h):
g = 9.81
return rho * g * h
depth = 5 # m
p = hydrostatic_pressure(1000, depth)
print(f"Pressure at {depth} m depth: {p/1000:.2f} kPa")
Concept:
Continuity Equation: Q = A * v
Bernoulli Equation for energy in fluids.
Python Example:
import math
# Continuity
diameter1 = 0.3 # m
velocity1 = 2 # m/s
area1 = math.pi * (diameter1**2) / 4
Q = area1 * velocity1 # m³/s
diameter2 = 0.2 # m
area2 = math.pi * (diameter2**2) / 4
velocity2 = Q / area2
print(f"Flow rate: {Q:.4f} m³/s")
print(f"Velocity in smaller pipe: {velocity2:.2f} m/s")
Concept:
Distance from coordinates (Pythagoras)
Area by coordinates (Surveyor’s formula)
Python Example:
# Distance between two points
import math
x1, y1 = (0, 0)
x2, y2 = (100, 50)
distance = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
print(f"Distance: {distance:.2f} m")
# Polygon area (Surveyor's formula)
coords = [(0,0), (100,0), (100,50), (0,50)]
area = 0
for i in range(len(coords)):
x1, y1 = coords[i]
x2, y2 = coords[(i+1) % len(coords)]
area += (x1*y2 - x2*y1)
area = abs(area) / 2
print(f"Area: {area} m²")
Concept:
Axial stress
Beam bending formula: σ = M*y / I
Python Example:
# Bending stress
M = 5000 # Nm
y = 0.15 # m
I = 8.1e-6 # m⁴
sigma = M * y / I
print(f"Bending stress: {sigma/1e6:.2f} MPa")
Concept:
Water demand per capita
Simplified Penman-Monteith for ET₀
Python Example:
# Simple water demand estimation
population = 5000
demand_per_capita = 135 # L/day
total_demand = population * demand_per_capita # L/day
print(f"Total daily water demand: {total_demand/1000:.2f} m³/day")
# Simple ET0 estimation (Temperature-based, Hargreaves)
def et0_hargreaves(T_mean, T_max, T_min, Ra):
return 0.0023 * (T_mean + 17.8) * ((T_max - T_min)**0.5) * Ra
ET0 = et0_hargreaves(28, 34, 22, 20)
print(f"Estimated ET0: {ET0:.2f} mm/day")
✅ Outcome of 8-Hour Module:
Understand core civil engineering concepts (mechanics, hydraulics, surveying, materials, environmental engineering).
Hands-on practice with Python for calculations, data processing, and modeling.
Ready-to-use Python scripts for future engineering projects.
Here is a clear and detailed project plan for an undergraduate student based on your abstract. Sentences are short. Language is simple. C...