From 29f058c8cf8137290f5147d9745e9923588eb119 Mon Sep 17 00:00:00 2001 From: Ibraheem-Div Date: Fri, 17 Jul 2026 16:08:57 +0300 Subject: [PATCH 1/2] Add engine search functionality in main.py Implement engine search functionality with user input and data retrieval from CSV. --- Projects/BMW_Engine-Search/main.py | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Projects/BMW_Engine-Search/main.py diff --git a/Projects/BMW_Engine-Search/main.py b/Projects/BMW_Engine-Search/main.py new file mode 100644 index 0000000..0e1493a --- /dev/null +++ b/Projects/BMW_Engine-Search/main.py @@ -0,0 +1,44 @@ +#import a library +import csv + +#function read data +def read_data(): + new_data=[] + with open('Data.csv', mode='r' , encoding='utf-8') as file: + reader= csv.DictReader(file) + for row in reader: + new_data.append(row) + return new_data +#function take a input user +def take_order(): + user_order=input('What the Engine you search:') + user_order=user_order.strip().upper() + return user_order +#function use loop to search in data from user order +def search_engine (engine_list,search_code): + for engine in engine_list : + if engine ['EngineName'].strip().upper() == search_code: + return engine + return None +#fuction print a result +def output (engine): + if engine is None : + print ('Sorry, this engine is not in database') + else: + print("--The engine was successfully found--") + print(f"Name engine: {engine['EngineName']}") + print(f"Code engine: {engine['EngineCode']}") + print(f"Engine displacement: {engine['Capacity']}") + print(f"Cylinders: {engine['Cylinders']}") + print(f"Aspiration: {engine['Aspiration']}") + print(f"Max RPM: {engine['RedLine']}") + print(f"HP: {engine['Power']}") + print(f"Torque: {engine['EngineTorque']}") + print(f"Chassis: {engine['Chassis']}") + print(f"Fuel Type: {engine['FuelType']}") + +#link the functions +engine_data=read_data() +user_data=take_order() +matched_engine=search_engine(engine_data,user_data) +output(matched_engine) From ea18a0e28e99e9f7deca599d991506d82ff0ac9a Mon Sep 17 00:00:00 2001 From: Ibraheem-Div Date: Fri, 17 Jul 2026 16:10:06 +0300 Subject: [PATCH 2/2] Add files via upload --- Projects/BMW_Engine-Search/Data.csv | 9 ++++++ Projects/BMW_Engine-Search/README.md | 46 ++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 Projects/BMW_Engine-Search/Data.csv create mode 100644 Projects/BMW_Engine-Search/README.md diff --git a/Projects/BMW_Engine-Search/Data.csv b/Projects/BMW_Engine-Search/Data.csv new file mode 100644 index 0000000..0b6f807 --- /dev/null +++ b/Projects/BMW_Engine-Search/Data.csv @@ -0,0 +1,9 @@ +EngineName,EngineCode,Capacity,Cylinders,Aspiration,RedLine,Power,EngineTorque,Chassis,FuelType +M20,M20B25,2494 CC,Inline-6,Naturally aspirated,6500 RPM,169 HP at 5800 RPM,226 NM at 4300 RPM,"1985–1993 E30 3 Series 325i,1989–1990 E34 5 Series 525i,1988–1991 Z1",Petrol +S14,S14B25 EVO3,2467 CC,Inline-4,Naturally aspirated,7300 RPM,235 HP at 7000 RPM,240 NM at 4750 RPM,"1989-1990 E30 M3",Petrol +S54,S54B32,3246 CC,Inline-6,Naturally aspirated,8000 RPM,338 HP at 7900 RPM,365 NM at 4900 RPM,"2000–2006 E46 M3,2000–2002 Z3 M ,2006-2008 Z4 M",Petrol +S54HP,S54B32HP,3246 CC,Inline-6,Naturally aspirated,8000 RPM,360 HP at 7900 RPM,370 NM at 4900 RPM,2003 E46 M3 CSL,Petrol +B58,B58B30O1,2998 CC,Inline-6,Turbocharger,7000 RPM,382 HP at 5000–6500 RPM,500 NM at 1600–4500 RPM,"2019–2026 G29 Z4 M40i ,2019–2024 G20/G21 M340i, 2020–2024 G01 X3 M40i, 2019–2024 G02 X4 M40i, 2021–present G22/G23/G26 M440i, 2021–present Toyota Supra, 2021–present G42 M240i, 2021–present Boldmen CR4",Petrol +S58,S58B30T0,2993 CC,Inline-6,Twin-Turbocharger,7200 RPM,503 HP at 6250 RPM,650 NM at 2600–5950 RPM,"2019–present F97 X3 M Competition, 2019–present F98 X4 M Competition, 2021–present G80 M3 Competition, 2021–present G82 M4 Competition, 2022–present G81 M3 Competition Touring",Petrol +B48,B48B20,1998 CC, Inline-4,Turbocharger,7000 RPM,154 HP at 4500–6500 RPM,250 NM at 1300–4300 RPM,"2020–present G20 318i,2022–present G42 218i",Petrol +M57,M57D30TÜ2,2993 CC,Inline-6,Twin-Turbocharger,4750 RPM,228 HP at 4000 RPM,520 NM at 2000-2750 RPM,"E65/E66 as 730d, E90/E91/E92/E93 as 330d/330xd,E60/E61 as 530d/530xd",Diesel \ No newline at end of file diff --git a/Projects/BMW_Engine-Search/README.md b/Projects/BMW_Engine-Search/README.md new file mode 100644 index 0000000..bd82e0a --- /dev/null +++ b/Projects/BMW_Engine-Search/README.md @@ -0,0 +1,46 @@ +# BMW Engines Search CLI Tool + +A lightweight and efficient Command Line Interface (CLI) tool written in Python to search and retrieve detailed technical specifications of various BMW engines from a CSV database. + +## 🚀 Features +* **Modular Architecture:** Clean code divided into dedicated functions for reading data, processing input, searching, and displaying results. +* **Smart Search:** Case-insensitive search with automatic whitespace trimming (e.g., searching `b48` or ` M20 ` works perfectly). +* **Robust Error Handling:** Smooth user experience that handles non-existent engines without crashing the application. +* **CSV Powered:** Dynamically loads data from an external `Data.csv` file using Python's native `csv.DictReader`. + +## 🏎️ Supported Engines +The database currently supports detailed technical lookups for the following BMW engine families: +* **M20** (Classic Inline-6) +* **S14** (High-performance Inline-4) +* **S54 & S54HP** (Legendary Naturally Aspirated M-Power Inline-6) +* **B58** (Modern Turbocharged TwinPower Cargo Inline-6) +* **B48** (Efficient TwinPower Turbo Inline-4) + +## 📂 Project Structure +* `main.py` - The core Python script containing the application logic. +* `Data.csv` - The database containing engine specs (Name, Code, Capacity, Cylinders, Horsepower, Torque, etc.). +* `README.md` - Documentation of the project. + +## 🛠️ Requirements & Installation +1. Make sure you have **Python 3.x** installed. +2. Clone this repository or download the source files. +3. Place your `Data.csv` in the same directory as `main.py`. + +## 💻 How to Run +Open your terminal/command prompt in the project folder and run: +```bash +python main.py + + +## 📊 Sample Output +```Text +What the Engine you search: b48 +--The engine was successfully found-- +Name engine: B48 +Code engine: B48B20 +Engine displacement: 1998 CC +... +``` + +## ⚖️ Disclaimer +This project is for educational and informational purposes only. The technical data provided within this database is gathered for general reference. The author is not responsible for any misuse, incorrect mechanical modifications, part installations, or diagnostic errors resulting from the use of this software. Always consult official BMW factory service manuals for actual garage operations or engine swaps.