Update page 'Day 2 homework - Sloetjes'
@@ -154,7 +154,7 @@ def validate(input_string):
|
||||
raise ValueError("Crime detected!")
|
||||
```
|
||||
|
||||
In this example of the function, we check if the input string contains the `"\r"` character using the in keyword, and raise a `ValueError` exception if it does. This ensures that any input containing the `"\r"` character is explicitly disallowed and treated as potentially malicious.
|
||||
In this example of the `validate()` function, we check if the input string contains the `"\r"` character using the in keyword, and raise a `ValueError` exception if it does. This ensures that any input containing the `"\r"` character is explicitly disallowed and treated as potentially malicious.
|
||||
|
||||
We can then use this `validate()` function in the test cases as follows:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user