-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring_analysis.py
More file actions
28 lines (22 loc) · 950 Bytes
/
string_analysis.py
File metadata and controls
28 lines (22 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
"""String Analysis
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1b3bN-V-Vfhn0q4t72EeU4SVjzU5IcxUL
"""
def analyze_email(email):
total_chars=len(email)
lowercase_count=sum(c.islower() for c in email)
uppercase_count=sum(c.isupper() for c in email)
digit_count=sum(c.isdigit() for c in email)
other_count=total_chars-(lowercase_count+uppercase_count+digit_count)
lowercase_percentage=round((lowercase_count/total_chars)*100,3)
uppercase_percentage=round((uppercase_count/total_chars)*100,3)
digit_percentage=round((digit_count/total_chars)*100,3)
other_percentage=round((other_count/total_chars)*100,3)
print(f"{uppercase_percentage}%")
print(f"{lowercase_percentage}%")
print(f"{digit_percentage}%")
print(f"{other_percentage}%")
email_address="Support1@litwork.in"
result=analyze_email(email_address)