-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode used
More file actions
21 lines (15 loc) · 1.03 KB
/
code used
File metadata and controls
21 lines (15 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Define a function named analyze_logins() that takes in three parameters: username, current_day_logins, and average_day_logins
def analyze_logins(username, current_day_logins, average_day_logins):
# Display a message about how many login attempts the user has made that day
print("Current day login total for", username, "is", current_day_logins)
# Display a message about average number of login attempts the user has made that day
print("Average logins per day for", username, "is", average_day_logins)
# Calculate the ratio of the logins made on the current day to the logins made on an average day, storing in a variable named `login_ratio`
login_ratio = current_day_logins / average_day_logins
# Return the ratio
return login_ratio
# Call analyze_logins() and store the output in a variable named login_analysis
login_analysis = analyze_logins("ejones", 9, 3)
# Conditional statement that displays an alert about the login activity if it's more than normal
if login_analysis >= 3:
print("Alert! This account has more login activity than normal.")