Skip to content

Commit dc53e86

Browse files
committed
added in read me file
1 parent 5d51e2c commit dc53e86

File tree

3 files changed

+90
-2
lines changed

3 files changed

+90
-2
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
more-projects.ipynb
2-
decision-control-in-python.ipynb
2+
guess_the_number_project-1.ipynb

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This repository covers the following fundamental Python concepts:
2929
### Notebooks Included
3030

3131
Each notebook in this repository covers a specific topic and includes practical examples to reinforce your learning. The notebooks are designed to be hands-on, so you can experiment with the code directly:
32-
32+
- [Decision Control](decision-control-in-python.ipynb) - Learn how to implement **decision control** structures in Python using if-else statements and conditional logic. This notebook provides clear examples of how to control the flow of your program based on various conditions.
3333
- [Literals in Python](Literals_in_Python.ipynb) – Introduction to Python **literals** and data representation.
3434
- [Operators in Python](Operators_in_Python.ipynb) – Learn how to perform operations using Python **operators**.
3535
- [Type Conversion](Type-Conversion.ipynb)**Type casting** and converting between different **data types** in Python.

decision-control-in-python.ipynb

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stdout",
10+
"output_type": "stream",
11+
"text": [
12+
"You are an adult.\n",
13+
"Good afternoon!\n",
14+
"It's hot outside!\n",
15+
"It's a warm day, perfect for a walk!\n",
16+
"Welcome to the Number Guessing Game!\n",
17+
"I have selected a number between 1 and 100. Try to guess it.\n"
18+
]
19+
}
20+
],
21+
"source": [
22+
"# Define a variable to store the user's age\n",
23+
"age = 25\n",
24+
"\n",
25+
"# Check if the user is 18 or older\n",
26+
"if age >= 18:\n",
27+
" # If the condition is true (age is 18 or older), print the message\n",
28+
" print(\"You are an adult.\")\n",
29+
"else:\n",
30+
" # If the condition is false (age is less than 18), print this message\n",
31+
" print(\"You are a minor.\")\n",
32+
" \n",
33+
"# Another example with more conditions\n",
34+
"# Let's define a variable for the time of the day (in 24-hour format)\n",
35+
"time_of_day = 14 # 14 means 2 PM\n",
36+
"\n",
37+
"# Check if it's morning, afternoon, or evening\n",
38+
"if time_of_day < 12:\n",
39+
" # If the time is less than 12, it's morning\n",
40+
" print(\"Good morning!\")\n",
41+
"elif time_of_day < 18:\n",
42+
" # If the time is less than 18 but 12 or more, it's afternoon\n",
43+
" print(\"Good afternoon!\")\n",
44+
"else:\n",
45+
" # If the time is 18 or more, it's evening\n",
46+
" print(\"Good evening!\")\n",
47+
" \n",
48+
"# Example of a nested if-else statement\n",
49+
"temperature = 30 # Current temperature in Celsius\n",
50+
"\n",
51+
"# Check if it's hot or cold\n",
52+
"if temperature > 25:\n",
53+
" print(\"It's hot outside!\")\n",
54+
" # If it's hot, check if it's too hot to go outside\n",
55+
" if temperature > 35:\n",
56+
" print(\"It's too hot to go outside.\")\n",
57+
" else:\n",
58+
" print(\"It's a warm day, perfect for a walk!\")\n",
59+
"else:\n",
60+
" print(\"It's a cool day.\")\n",
61+
"\n",
62+
"\n",
63+
"\n"
64+
]
65+
}
66+
],
67+
"metadata": {
68+
"kernelspec": {
69+
"display_name": "Python 3",
70+
"language": "python",
71+
"name": "python3"
72+
},
73+
"language_info": {
74+
"codemirror_mode": {
75+
"name": "ipython",
76+
"version": 3
77+
},
78+
"file_extension": ".py",
79+
"mimetype": "text/x-python",
80+
"name": "python",
81+
"nbconvert_exporter": "python",
82+
"pygments_lexer": "ipython3",
83+
"version": "3.13.1"
84+
}
85+
},
86+
"nbformat": 4,
87+
"nbformat_minor": 2
88+
}

0 commit comments

Comments
 (0)