Skip to content

Commit da59d4c

Browse files
authored
Merge branch 'main' into fix/overlapping-sidebar
2 parents b99369d + 8131543 commit da59d4c

33 files changed

Lines changed: 2523 additions & 1383 deletions

README.md

Lines changed: 161 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,141 @@ python-mini-project/
9090
└── requirements.txt
9191
```
9292

93+
## 🚀 Getting Started
94+
95+
### Prerequisites
96+
97+
- Python 3.10 or higher
98+
- Git (for cloning the repository)
99+
- pip (Python package manager)
100+
101+
### Installation Steps
102+
103+
#### 1. Clone the Repository
104+
105+
```bash
106+
git clone https://github.com/steam-bell-92/python-mini-project.git
107+
cd python-mini-project
108+
```
109+
110+
#### 2. Create a Virtual Environment
111+
112+
For Linux/macOS:
113+
```bash
114+
python3 -m venv venv
115+
source venv/bin/activate
116+
```
117+
118+
For Windows (Command Prompt):
119+
```bash
120+
python -m venv venv
121+
venv\Scripts\activate
122+
```
123+
124+
For Windows (PowerShell):
125+
```bash
126+
python -m venv venv
127+
venv\Scripts\Activate.ps1
128+
```
129+
130+
#### 3. Install Dependencies
131+
132+
```bash
133+
pip install --upgrade pip
134+
pip install -r requirements.txt
135+
```
136+
137+
### Running Command-Line Projects
138+
139+
Each Python project in `games/`, `math/`, and `utilities/` folders can be run independently.
140+
141+
#### Example: Running a Game
142+
143+
```bash
144+
cd games/Snake-Game
145+
python Snake-Game.py
146+
```
147+
148+
#### Example: Running a Math Project
149+
150+
```bash
151+
cd math/Fibonacci-Series
152+
python Fibonacci-Series.py
153+
```
154+
155+
#### Example: Running a Utility
156+
157+
```bash
158+
cd utilities/Text-to-Morse
159+
python Text-to-Morse.py
160+
```
161+
162+
### Running the Web App
163+
164+
The web application provides a browser-based interface for all projects.
165+
166+
#### Prerequisites for Web App
167+
168+
The web app requires Node.js and npm:
169+
- Download from https://nodejs.org/ (v16 or higher recommended)
170+
- Verify installation: `node --version && npm --version`
171+
172+
#### Steps to Run Web App
173+
174+
```bash
175+
cd web-app
176+
npm install
177+
npm start
178+
```
179+
180+
The app will open at `http://localhost:3000` (or your configured port).
181+
182+
### Running Tests
183+
184+
To verify that the projects work correctly, run the test suite:
185+
186+
```bash
187+
pytest tests/ -v
188+
```
189+
190+
For specific test file:
191+
```bash
192+
pytest tests/test_armstrong.py -v
193+
```
194+
195+
### Development Workflow
196+
197+
#### Creating a New Project
198+
199+
1. Choose appropriate directory: `games/`, `math/`, or `utilities/`
200+
2. Create a new folder with your project name (use PascalCase)
201+
3. Add your `.py` file with the same name as the folder
202+
4. Include a `README.md` in your project folder with usage instructions
203+
5. Add tests in `tests/` directory with prefix `test_`
204+
205+
#### Code Guidelines
206+
207+
- Follow PEP 8 style guide
208+
- Write docstrings for functions and classes
209+
- Add unit tests for your code
210+
- Test your project before submitting a PR
211+
212+
#### Virtual Environment Reminder
213+
214+
Always activate your virtual environment before working:
215+
```bash
216+
# Linux/macOS
217+
source venv/bin/activate
218+
219+
# Windows
220+
venv\Scripts\activate
221+
```
222+
223+
Deactivate when done:
224+
```bash
225+
deactivate
226+
```
227+
93228
## 🧩 What’s Inside
94229

95230
- Games for quick interactive fun
@@ -608,20 +743,26 @@ These standalone Python project files do not have a browser counterpart yet and
608743
<sub><b>@advikdivekar</b></sub>
609744
</a>
610745
</td>
746+
<td align="center" width="120">
747+
<a href="https://github.com/anshul23102">
748+
<img src="https://github.com/anshul23102.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="anshul23102" /><br />
749+
<sub><b>@anshul23102</b></sub>
750+
</a>
751+
</td>
611752
<td align="center" width="120">
612753
<a href="https://github.com/anujsharma8d">
613754
<img src="https://github.com/anujsharma8d.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="anujsharma8d" /><br />
614755
<sub><b>@anujsharma8d</b></sub>
615756
</a>
616757
</td>
758+
</tr>
759+
<tr>
617760
<td align="center" width="120">
618761
<a href="https://github.com/artic2702">
619762
<img src="https://github.com/artic2702.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="artic2702" /><br />
620763
<sub><b>@artic2702</b></sub>
621764
</a>
622765
</td>
623-
</tr>
624-
<tr>
625766
<td align="center" width="120">
626767
<a href="https://github.com/ash-heinz">
627768
<img src="https://github.com/ash-heinz.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="ash-heinz" /><br />
@@ -652,14 +793,14 @@ These standalone Python project files do not have a browser counterpart yet and
652793
<sub><b>@basantnema31</b></sub>
653794
</a>
654795
</td>
796+
</tr>
797+
<tr>
655798
<td align="center" width="120">
656799
<a href="https://github.com/bhavyapandiya29">
657800
<img src="https://github.com/bhavyapandiya29.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="bhavyapandiya29" /><br />
658801
<sub><b>@bhavyapandiya29</b></sub>
659802
</a>
660803
</td>
661-
</tr>
662-
<tr>
663804
<td align="center" width="120">
664805
<a href="https://github.com/codewithakshyaaa">
665806
<img src="https://github.com/codewithakshyaaa.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="codewithakshyaaa" /><br />
@@ -690,14 +831,14 @@ These standalone Python project files do not have a browser counterpart yet and
690831
<sub><b>@dikshajha13</b></sub>
691832
</a>
692833
</td>
834+
</tr>
835+
<tr>
693836
<td align="center" width="120">
694837
<a href="https://github.com/gatiksolanki13-netizen">
695838
<img src="https://github.com/gatiksolanki13-netizen.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="gatiksolanki13-netizen" /><br />
696839
<sub><b>@gatiksolanki13-netizen</b></sub>
697840
</a>
698841
</td>
699-
</tr>
700-
<tr>
701842
<td align="center" width="120">
702843
<a href="https://github.com/iamprasoon2006-cell">
703844
<img src="https://github.com/iamprasoon2006-cell.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="iamprasoon2006-cell" /><br />
@@ -728,14 +869,14 @@ These standalone Python project files do not have a browser counterpart yet and
728869
<sub><b>@jyotish6699</b></sub>
729870
</a>
730871
</td>
872+
</tr>
873+
<tr>
731874
<td align="center" width="120">
732875
<a href="https://github.com/knoxiboy">
733876
<img src="https://github.com/knoxiboy.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="knoxiboy" /><br />
734877
<sub><b>@knoxiboy</b></sub>
735878
</a>
736879
</td>
737-
</tr>
738-
<tr>
739880
<td align="center" width="120">
740881
<a href="https://github.com/kumudasrip">
741882
<img src="https://github.com/kumudasrip.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="kumudasrip" /><br />
@@ -766,14 +907,14 @@ These standalone Python project files do not have a browser counterpart yet and
766907
<sub><b>@mrinmoyChakraborty-mrinox</b></sub>
767908
</a>
768909
</td>
910+
</tr>
911+
<tr>
769912
<td align="center" width="120">
770913
<a href="https://github.com/n1o5">
771914
<img src="https://github.com/n1o5.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="n1o5" /><br />
772915
<sub><b>@n1o5</b></sub>
773916
</a>
774917
</td>
775-
</tr>
776-
<tr>
777918
<td align="center" width="120">
778919
<a href="https://github.com/nene-hana">
779920
<img src="https://github.com/nene-hana.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="nene-hana" /><br />
@@ -804,14 +945,14 @@ These standalone Python project files do not have a browser counterpart yet and
804945
<sub><b>@palak-paliwal11</b></sub>
805946
</a>
806947
</td>
948+
</tr>
949+
<tr>
807950
<td align="center" width="120">
808951
<a href="https://github.com/parasmani-dev">
809952
<img src="https://github.com/parasmani-dev.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="parasmani-dev" /><br />
810953
<sub><b>@parasmani-dev</b></sub>
811954
</a>
812955
</td>
813-
</tr>
814-
<tr>
815956
<td align="center" width="120">
816957
<a href="https://github.com/parulpaliwal01">
817958
<img src="https://github.com/parulpaliwal01.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="parulpaliwal01" /><br />
@@ -842,14 +983,14 @@ These standalone Python project files do not have a browser counterpart yet and
842983
<sub><b>@r-sushanth08</b></sub>
843984
</a>
844985
</td>
986+
</tr>
987+
<tr>
845988
<td align="center" width="120">
846989
<a href="https://github.com/rashiaggarwal06">
847990
<img src="https://github.com/rashiaggarwal06.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="rashiaggarwal06" /><br />
848991
<sub><b>@rashiaggarwal06</b></sub>
849992
</a>
850993
</td>
851-
</tr>
852-
<tr>
853994
<td align="center" width="120">
854995
<a href="https://github.com/rishit537">
855996
<img src="https://github.com/rishit537.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="rishit537" /><br />
@@ -880,14 +1021,14 @@ These standalone Python project files do not have a browser counterpart yet and
8801021
<sub><b>@sanzzzz-g</b></sub>
8811022
</a>
8821023
</td>
1024+
</tr>
1025+
<tr>
8831026
<td align="center" width="120">
8841027
<a href="https://github.com/shaktipy">
8851028
<img src="https://github.com/shaktipy.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="shaktipy" /><br />
8861029
<sub><b>@shaktipy</b></sub>
8871030
</a>
8881031
</td>
889-
</tr>
890-
<tr>
8911032
<td align="center" width="120">
8921033
<a href="https://github.com/shimonenator">
8931034
<img src="https://github.com/shimonenator.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="shimonenator" /><br />
@@ -918,14 +1059,14 @@ These standalone Python project files do not have a browser counterpart yet and
9181059
<sub><b>@snehacodes-2906</b></sub>
9191060
</a>
9201061
</td>
1062+
</tr>
1063+
<tr>
9211064
<td align="center" width="120">
9221065
<a href="https://github.com/snehanair-486">
9231066
<img src="https://github.com/snehanair-486.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="snehanair-486" /><br />
9241067
<sub><b>@snehanair-486</b></sub>
9251068
</a>
9261069
</td>
927-
</tr>
928-
<tr>
9291070
<td align="center" width="120">
9301071
<a href="https://github.com/steam-bell-92">
9311072
<img src="https://github.com/steam-bell-92.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="steam-bell-92" /><br />
@@ -956,14 +1097,14 @@ These standalone Python project files do not have a browser counterpart yet and
9561097
<sub><b>@unknown-tech-ui</b></sub>
9571098
</a>
9581099
</td>
1100+
</tr>
1101+
<tr>
9591102
<td align="center" width="120">
9601103
<a href="https://github.com/vedansht2211">
9611104
<img src="https://github.com/vedansht2211.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="vedansht2211" /><br />
9621105
<sub><b>@vedansht2211</b></sub>
9631106
</a>
9641107
</td>
965-
</tr>
966-
<tr>
9671108
<td align="center" width="120">
9681109
<a href="https://github.com/vedika76">
9691110
<img src="https://github.com/vedika76.png?size=100" width="100" height="100" style="border-radius:50%; border:2px solid #555;" alt="vedika76" /><br />
@@ -989,7 +1130,6 @@ These standalone Python project files do not have a browser counterpart yet and
9891130
</a>
9901131
</td>
9911132
<td width="120"></td>
992-
<td width="120"></td>
9931133
</tr>
9941134
</table>
9951135
<!-- CONTRIBUTORS_END -->

games/Flipping-Toss/Flipping-Toss.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ def main():
1616

1717
if choice == "y":
1818
num = random.randint(1, 2)
19-
# User prediction
20-
prediction = input("Predict the result (H/T): ").lower().strip()
19+
20+
# Sub-loop for validating user prediction without resetting the game loop
21+
while True:
22+
prediction = input("Predict the result (H/T): ").lower().strip()
2123

22-
if prediction not in ["h", "t"]:
24+
if prediction in ["h", "t"]:
25+
break
2326
print("❌ Invalid prediction!! Please enter 'H' or 'T'.\n")
24-
continue
2527

2628
print("🪙 Flipping...")
2729
time.sleep(2)
@@ -67,4 +69,4 @@ def main():
6769

6870

6971
if __name__ == '__main__':
70-
main()
72+
main()

0 commit comments

Comments
 (0)