@@ -133,44 +133,65 @@ False
133
133
---
134
134
135
135
136
- ???+ question "Password strength : Part 1"
136
+ ???+ question "Evaluate password security requirements : Part 1"
137
137
138
138
<figure markdown =" span " >
139
139
![ Secure lock] ( https://preview.redd.it/j7i00nnpx6211.jpg?width=640&crop=smart&auto=webp&s=d4b58226076d45f0c637fd3789d3ccb547a4a54a ) { width=50% }
140
140
</figure >
141
141
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:
145
150
146
151
```py
147
152
password_length = 18
148
153
has_special_characters = False
149
154
```
150
155
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
152
163
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 .
155
166
156
- Use comparison together with logical operators to solve the task.
167
+ ???+ question "Evaluate password security requirements: Part 2"
157
168
158
- ???+ question "Password strength: Part 2"
169
+ To increase security, a third variable is introduced alongside the
170
+ previous password properties:
159
171
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`)
163
174
164
- - Has more than 10 characters
165
- - Contains special characters
166
- - and was not already used before
175
+ Variables to use:
167
176
168
177
```py
169
178
password_length = 18
170
179
has_special_characters = True
171
180
already_used = False
172
181
```
173
182
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
+
174
195
## Recap
175
196
176
197
We have covered the basic comparison and logical operators in ` Python `
0 commit comments