Skip to content

Commit 2b7c5e2

Browse files
authored
Merge pull request #43 from mciwing/fixes
[Python Crash Course] Fixes (stemming from the first session)
2 parents d567e38 + d8f0bb7 commit 2b7c5e2

File tree

3 files changed

+38
-16
lines changed

3 files changed

+38
-16
lines changed

docs/python/comparisons_and_logic.md

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -133,44 +133,65 @@ False
133133
---
134134

135135

136-
???+ question "Password strength: Part 1"
136+
???+ question "Evaluate password security requirements: Part 1"
137137

138138
<figure markdown="span">
139139
![Secure lock](https://preview.redd.it/j7i00nnpx6211.jpg?width=640&crop=smart&auto=webp&s=d4b58226076d45f0c637fd3789d3ccb547a4a54a){ width=50% }
140140
</figure>
141141

142-
It's your time to check if a password meets certain requirements.
143-
Use the following defined variables `password_length` and
144-
`has_special_characters` to evaluate if the password is secure.
142+
You are given two variables that describe properties of a password:
143+
144+
- `password_length` - represents how many characters are in the password
145+
(`#!python int`)
146+
- `has_special_characters` - represents whether the password contains
147+
special characters (`#!python True`/`#!python False`)
148+
149+
Variables to use:
145150

146151
```py
147152
password_length = 18
148153
has_special_characters = False
149154
```
150155

151-
The password is secure if:
156+
Task:
157+
158+
Write code that checks if this password is secure based on these
159+
requirements:
160+
161+
1. The password must be longer than 10 characters
162+
2. The password must contain special characters
152163

153-
- it exceeds a certain length (10 characters)
154-
- and contains special characters.
164+
Use comparisons and logical operators to create a single expression
165+
that evaluates whether **BOTH** requirements are met.
155166

156-
Use comparison together with logical operators to solve the task.
167+
???+ question "Evaluate password security requirements: Part 2"
157168

158-
???+ question "Password strength: Part 2"
169+
To increase security, a third variable is introduced alongside the
170+
previous password properties:
159171

160-
To increase security, a third variable is introduced, namely
161-
`already_used` which is a boolean value and indicates whether the password
162-
was already in use. Now, check if all of these requirements are met:
172+
`already_used` - represents whether this password has been used before
173+
(`#!python True`/`#!python False`)
163174

164-
- Has more than 10 characters
165-
- Contains special characters
166-
- and was not already used before
175+
Variables to use:
167176

168177
```py
169178
password_length = 18
170179
has_special_characters = True
171180
already_used = False
172181
```
173182

183+
Task:
184+
185+
Write code that checks if this password is secure based on these three
186+
requirements:
187+
188+
1. The password must be longer than 10 characters
189+
2. The password must contain special characters
190+
3. The password must not have been used before
191+
192+
Build on your previous solution and evaluate whether all **THREE**
193+
requirements are met.
194+
174195
## Recap
175196

176197
We have covered the basic comparison and logical operators in `Python`

docs/python/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ After the successful installation, we recommend to open a command prompt
2424
typing
2525

2626
```commandline
27-
python --version.
27+
python --version
2828
```
2929

3030
Which should result in:

docs/python/types/strings.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ On the other hand, methods are associated with objects. In this case, the
103103
Experiment and apply a combination of the following methods:
104104

105105
- `capitalize()`
106+
- `title()`
106107
- `istitle()`
107108
- `isupper()`
108109
- `upper()`

0 commit comments

Comments
 (0)