Skip to content

Commit

Permalink
Basic
Browse files Browse the repository at this point in the history
  • Loading branch information
SanjanaPurbia authored Sep 3, 2021
1 parent 5803dd6 commit 98e83a0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions strsize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#counting alpha,digit,space& symbols

msg ="india @20 #311200"
alpha,digit,space,symbol=0,0,0,0
for ch in msg:
if ch.isalpha():
alpha += 1
elif ch.isdigit():
digit +=1
elif ch.isspace():
space += 1
else:
symbol += 1
else:
print("Alpha: %d\nDigit: %d\nSpace: %d\nSymbol: %d"\
%(alpha,digit,space,symbol))
size =len(msg)
print("size : %d" %size)

if symbol >=size*0.2:
print("string is meaningless")
else:
print("string is meaningfull")

0 comments on commit 98e83a0

Please sign in to comment.