Skip to content

Commit 5249947

Browse files
Update README.md
1 parent 15cf4eb commit 5249947

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

week_4/README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,42 @@
1-
## Conditional Statements in Python
1+
# Conditional Statements in Python
22

33
Conditional statements in Python are used to make decisions in your code. They allow you to execute certain blocks of code based on whether a condition is `True` or `False`.
44

5-
### Basic Syntax
5+
## Basic Syntax
66

77
The basic syntax for a conditional statement is:
88

99
```python
10+
1011
if condition:
1112
# Code to execute if the condition is True
1213
elif another_condition:
1314
# Code to execute if the second condition is True
1415
else:
1516
# Code to execute if none of the above conditions are True
17+
```
18+
## Practice Questions: Conditional Statements in Python
19+
20+
### 1. Basic Condition
21+
Write a program that checks if a number is positive, negative, or zero. Print an appropriate message based on the result.
22+
23+
### 2. Even or Odd
24+
Write a program that checks if a given number is even or odd. Print "Even" if the number is even, and "Odd" if the number is odd.
25+
26+
### 3. Grading System
27+
Create a program that takes a student's score and prints the corresponding grade based on the following criteria:
28+
- 90 to 100: A
29+
- 80 to 89: B
30+
- 70 to 79: C
31+
- 60 to 69: D
32+
- Below 60: F
33+
34+
### 4. Age Category
35+
Write a program that categorizes a person into one of the following age groups:
36+
- Child (0-12)
37+
- Teenager (13-19)
38+
- Adult (20-64)
39+
- Senior (65 and above)
40+
41+
### 5. Password Strength
42+
Create a program that checks the strength of a password. Consider the password strong if it contains at least 8 characters, includes both uppercase and lowercase letters, and has at least one digit. Print "Strong" if the password meets these criteria, otherwise print "Weak".

0 commit comments

Comments
 (0)