Skip to content

Commit 2e9d29e

Browse files
authored
Merge branch 'main' into main
2 parents 0fafccc + 9e8c1bf commit 2e9d29e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2144
-10
lines changed

BMI Calculator (Flask)/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# BMI Calculator using Flask
2+
3+
A simple calculator used to calculate the Body Mass Index (BMI).
4+
5+
## Technologies used:
6+
7+
- HTML
8+
- CSS
9+
- Python
10+
- Flask
11+
12+
## How to use:
13+
14+
1. Fork and clone [this](https://github.com/Ayushparikh-code/Web-dev-mini-projects) project.
15+
2. In your command prompt, navigate to **Web-dev-mini-projects/BMI Calculator (Flask)**.
16+
3. Run this app using the command `python app.py`.
17+
4. Now, navigate to `http://127.0.0.1:5000/` in your web browser to use the calculator.
18+
19+
## Screenshot
20+
21+
<img src="https://imgur.com/PoJcIsR.png"/>

BMI Calculator (Flask)/app.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from flask import Flask, render_template, request
2+
3+
# declare the app
4+
app = Flask(__name__)
5+
6+
# start an app route
7+
@app.route("/")
8+
def main():
9+
return render_template("index.html")
10+
11+
12+
# route for bmi calculation result
13+
@app.route("/bmi", methods=["GET", "POST"])
14+
def calculate():
15+
try:
16+
w = float(request.form.get("weight"))
17+
h = float(request.form.get("height"))
18+
if w and h:
19+
bmi = round(w / ((h / 100) ** 2), 3)
20+
return render_template("index.html", bmi=bmi)
21+
except ValueError as error:
22+
error = "Please enter all the values"
23+
return render_template("index.html", error=error)
24+
25+
26+
if __name__ == "__main__":
27+
app.run(debug=True)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
body {
2+
font-size: 20px;
3+
text-align: center;
4+
background: #ace1af;
5+
font-family: "Quicksand", sans-serif;
6+
}
7+
8+
h1,
9+
h2 {
10+
text-align: center;
11+
padding-top: 25px;
12+
font-style: bold;
13+
}
14+
15+
table,
16+
th,
17+
td {
18+
border: 2px solid black;
19+
text-align: center;
20+
width: 50%;
21+
margin-left: auto;
22+
margin-right: auto;
23+
}
24+
25+
th {
26+
height: 45px;
27+
}
28+
29+
#calc_btn,
30+
#ht,
31+
#wt {
32+
padding: 7px;
33+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<!-- Required meta tags -->
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
<!-- Bootstrap CSS -->
8+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
9+
<!-- Stylesheets-->
10+
<link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='style.css') }}" />
11+
<!--Google Fonts-->
12+
<link rel="preconnect" href="https://fonts.googleapis.com">
13+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
14+
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500&display=swap" rel="stylesheet">
15+
<title>BMI Calculator</title>
16+
</head>
17+
<body>
18+
<h1>
19+
<u>BMI Calculator using Flask</u>
20+
</h1>
21+
<br>
22+
<!--Calculator starts-->
23+
<div class="container text-center">
24+
<div class="row">
25+
<div class="col-sm">
26+
<form action="/bmi" method="POST">
27+
<label for="height" id="ht">Height</label>
28+
<input type="text" name="height" class="u-full-width" placeholder="Height (in cm)" id="ht" />
29+
<br>
30+
<label for="weight" id="wt">Weight</label>
31+
<input type="text" name="weight" class="u-full-width" placeholder="Weight (in kg)" id="wt" />
32+
<br>
33+
<br>
34+
<input type="submit" value="Calculate" id="calc_btn" /> {% if bmi %} <div class="alert">
35+
<p>Your BMI is {{bmi}}</p>
36+
</div> {% else %} <div class="alert">
37+
<p>{{error}}</p>
38+
</div> {% endif %}
39+
</form>
40+
</div>
41+
</div>
42+
</div>
43+
<!--Calculator ends-->
44+
<hr>
45+
<!--BMI values chart-->
46+
<div class="container text-center">
47+
<div class="row">
48+
<div class="col-sm">
49+
<h2>
50+
<u>BMI Chart</u>
51+
</h2>
52+
<br>
53+
<table>
54+
<tr>
55+
<th>BMI Value</th>
56+
<th>Category</th>
57+
</tr>
58+
<tr>
59+
<td>
60+
<18.5 </td>
61+
<td>Underweight</td>
62+
</tr>
63+
<tr>
64+
<td>18.5 - 24.9</td>
65+
<td>Normal weight</td>
66+
</tr>
67+
<tr>
68+
<td>25 - 29.9</td>
69+
<td>Overweight</td>
70+
</tr>
71+
<tr>
72+
<td>>=30</td>
73+
<td>Obesity</td>
74+
</tr>
75+
</table>
76+
</div>
77+
</div>
78+
</div>
79+
</body>
80+
</html>

Basic Contact Form/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<h1>Basic Contact Form</h1>
2+
3+
<p>A Basic Contact Form written in HTML, CSS and JAVASCRIPT .</p>
4+
5+
### Use of the Project:
6+
7+
<p>This basic contact form can be added to any website to make it attractive. </p>
8+
9+
<h3>Used Technologies</h3>
10+
<ul>
11+
<li>HTML5</li>
12+
<li>CSS3</li>
13+
<li>JavaScript</li>
14+
</ul>
15+
16+
#### Steps to Use:
17+
18+
---
19+
20+
- Download or clone the repository
21+
22+
```
23+
git clone https://github.com/Ayushparikh-code/Web-dev-mini-projects.git
24+
```
25+
26+
- Go to the directory
27+
- Run the index.html file
28+
- Result is here!!!
29+
30+
<h3> Screenshot:</h3>
31+
<img src="https://user-images.githubusercontent.com/66966120/125250300-ec32c500-e2aa-11eb-8a50-31d4cf729d72.png" alt="Screenshot (19)" style="max-width:100%;">
32+
33+
34+
<h3> Demo </h3>
35+
36+
<a href="https://sonamgupta136.github.io/Basic-Contact-Form.io/">Demo</a>
37+
38+
<br>
39+

Basic Contact Form/app.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
let sendButton = document.getElementById('send');
2+
let resetButton = document.getElementById('reset');
3+
let form = document.getElementById('form');
4+
5+
6+
form.addEventListener('submit', function (e) {
7+
e.preventDefault();
8+
})
9+
10+
resetButton.addEventListener('click', function () {
11+
let name = document.getElementById('name');
12+
let email = document.getElementById('email');
13+
let message = document.getElementById('message');
14+
15+
name.value = '';
16+
email.value = '';
17+
message.value = '';
18+
})
19+
20+
sendButton.addEventListener('click', function (e) {
21+
let name = document.getElementById('name');
22+
let email = document.getElementById('email');
23+
let message = document.getElementById('message');
24+
25+
name = name.value;
26+
localStorage.setItem('name', name);
27+
28+
email = email.value;
29+
localStorage.setItem('email', email);
30+
31+
message = message.value;
32+
localStorage.setItem('message', message);
33+
34+
})
35+

Basic Contact Form/index.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<link rel="stylesheet" href="style.css">
9+
<title>Contact Form</title>
10+
</head>
11+
12+
<body>
13+
<form id="form">
14+
<h1>Please Contact me</h1>
15+
<div>
16+
<label for="name">Name</label></br>
17+
<input id="name" name="name">
18+
</div>
19+
<div>
20+
<label for="email">Email</label><br>
21+
<input type="email" id="email" name="email">
22+
</div>
23+
<div>
24+
<label for="message">Message</label><br>
25+
<textarea id="message" name="message"></textarea>
26+
</div>
27+
<div id="buttons-row">
28+
<div class="buttons">
29+
<button type="submit" id="send">Send</button>
30+
</div>
31+
<div class="buttons">
32+
<button id="reset">Reset</button>
33+
</div>
34+
</div>
35+
</form>
36+
<script src="app.js"></script>
37+
</body>
38+
39+
</html>
40+

Basic Contact Form/style.css

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
form {
2+
background-color: black;
3+
width: 500px;
4+
border-radius: 25px;
5+
height: 400px;
6+
padding: 25px;
7+
font-family: Arial, Helvetica, sans-serif;
8+
box-sizing: border-box;
9+
margin: 50px auto 50px;
10+
11+
}
12+
13+
form h1 {
14+
color: white;
15+
text-align: center;
16+
font-size: 22px;
17+
}
18+
19+
label {
20+
color: rgb(43, 134, 209);
21+
font-weight: bold;
22+
padding-bottom: 5px;
23+
padding-top: 15px;
24+
display: inline-block;
25+
}
26+
27+
input,
28+
textarea {
29+
box-sizing: border-box;
30+
width: 450px;
31+
height: 30px;
32+
padding-left: 5px;
33+
font-family: Arial, Helvetica, sans-serif;
34+
}
35+
36+
textarea {
37+
height: 50px;
38+
}
39+
40+
#buttons-row {
41+
display: flex;
42+
justify-content: space-evenly;
43+
}
44+
45+
button {
46+
flex-grow: 1;
47+
width: 125px;
48+
margin: 25px;
49+
border: none;
50+
border-radius: 15px;
51+
height: 35px;
52+
font-size: 20px;
53+
}
54+
55+
button#send {
56+
background-color: rgb(211, 59, 59);
57+
color: white;
58+
}
59+
60+
button#reset {
61+
background-color: rgb(253, 253, 54);
62+
color: black;
63+
}
64+

Blackjack Game/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Blackjack game
2+
The player has to get a hand with a value as close to 21 as possible without going over.
3+
A hand that goes over 21 is a bust.
4+
The players in a blackjack game plays against the dealer. Each player has to beat the dealer's hand in order to win.
5+
6+
In blackjack game, the suits have no meaning.
7+
1. Number cards have a value equal to their number.
8+
2. All the picture cards (Jacks, Queens, and Kings) are worth 10.
9+
3. Aces are worth 1.
10+
11+
12+
## HOW TO PLAY
13+
14+
## 1. When the user clicks "Hit" button , a card is drawn
15+
You can draw as many cards as you want
16+
17+
![image](https://github.com/TheArushiSingh/Web-dev-mini-projects/blob/main/Blackjack%20Game/readme%20images/img1.PNG)
18+
19+
### 2. You can click on "Stand" when you no longer want to draw cards and then the dealer will draw it's cards
20+
21+
## 3. If the sum of cards of the dealer is greater than your sum , then you loses the game
22+
23+
![](https://github.com/TheArushiSingh/Web-dev-mini-projects/blob/main/Blackjack%20Game/readme%20images/img2.PNG)
24+
25+
26+
## 4. If the sum of your cards is greater than 21 then you are busted and you loses the game
27+
28+
![](https://github.com/TheArushiSingh/Web-dev-mini-projects/blob/main/Blackjack%20Game/readme%20images/img3.PNG)
29+
30+
## 5. If your sum is greater than dealer's sum then you won the game
31+
32+
![](https://github.com/TheArushiSingh/Web-dev-mini-projects/blob/main/Blackjack%20Game/readme%20images/img4.PNG)
33+
34+
## 6. If Your Sum = Dealer's sum then the game draws
35+
36+
![](https://github.com/TheArushiSingh/Web-dev-mini-projects/blob/main/Blackjack%20Game/readme%20images/img5.PNG)
37+
38+
39+
7. The table keeps a record of total wins,loses and draws
40+
8. Click on "Restart" Button to start a new game
41+
9. Click on "Deal" Button to clear the field

Blackjack Game/images/10.png

32.4 KB
Loading

0 commit comments

Comments
 (0)