From 98e83a02121739e446cbd4f06e22925605d84320 Mon Sep 17 00:00:00 2001 From: Sanjana Purbia <71418488+SanjanaPurbia@users.noreply.github.com> Date: Fri, 3 Sep 2021 21:44:16 +0530 Subject: [PATCH] Basic --- strsize.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 strsize.py diff --git a/strsize.py b/strsize.py new file mode 100644 index 0000000..f44c9ae --- /dev/null +++ b/strsize.py @@ -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") \ No newline at end of file