Recap - Validation Function
Part of the Fundamentals section of Coddy's Python journey — lesson 47 of 77.
Challenge
EasyWrite a function named is_valid that gets two strings arguments, username and password.
The function will return True if the username and password are valid in the system, otherwise False.
Our system contains only two valid usernames - "admin" and "user".
The valid password for username "user" is "qweasd".
For username "admin" any password is valid!
Note: Do not call the function — we will test it automatically.
Try it yourself
def is_valid(username, password):
# Write code hereAll lessons in Fundamentals
4Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Logical Operators Part 48Loops
For LoopWhile LoopBreakContinueRecap - FactorialThe Range FunctionNested LoopRecap - Dynamic Input3Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsRecap - Simple MathComparison Operators9Functions
Declare a FunctionArgumentsReturnRecap - Sigma FunctionRecap - Validation FunctionDefault Values12Iterating Over Sequences
Iterating Over ElementsThe Enumerate FunctionIterating Over Strings Part 1Iterating Over Strings Part 2