uplownumpnct.py

Ethan Rosenberg <[email protected]> Mon, 1 Jan 2024 12:22:08 -0500
Newsgroups gmane.comp.python.tutor
Message-ID <CAFQ-1+eC60DqRiBJ2RnEvCmN3_bFybSY8AiD8QzyVot2SiROLg@mail.gmail.com>
Tutor -

What is my syntax error?

#uplownumpnct.py
#To determine uppercase, lowercase, punctuation and special characters in a
string


up=
['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
numm = [1,2,3,4,5,6,7,8,9,0]
pnct = [:,;.,,]
spec = [!,@,<,#,>,},$,%,&,?,*,(,),{,/,' ']

sent = 'THIS is the way we wash 1 2 3 , , !'
list2 = list(sent)
lgn = len(sent)
lgn2 = lgn
print(lgn)

for i in range(0,lgn-1):
{
        if list2[i] in up:
            upp+=

       if list2[i] in  low:
            lww+=

       if list2[i]  in numm:
            numnum+=

       if list2[i] in pnct:
            numpct+=

       if list2[i] in spec:
            numspec+=

}

     prnt

def prnt:
     print('Num uppercase  ', upp)
     print('Num lowercase  ',lww)
     print('Num  numbers ',  numnum)
     print('Num  punctuation  ', numpnct)
     print('Num  special characters' , numspec)
           #uplownumpnct.py
#To determine uppercase, lowercase, punctuation and special characters in a
string


up=
['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
numm = [1,2,3,4,5,6,7,8,9,0]
pnct = [:,;.,,]
spec = [!,@,<,#,>,},$,%,&,?,*,(,),{,/,' ']

sent = 'THIS is the way we wash 1 2 3 , , !'
list2 = list(sent)
lgn = len(sent)
lgn2 = lgn
print(lgn)

for i in range(0,lgn-1):
{
        if list2[i] in up:
            upp+=

       if list2[i] in  low:
            lww+=

       if list2[i]  in numm:
            numnum+=

       if list2[i] in pnct:
            numpct+=

       if list2[i] in spec:
            numspec+=

}

     prnt

def prnt:
     print('Num uppercase  ', upp)
     print('Num lowercase  ',lww)
     print('Num  numbers ',  numnum)
     print('Num  punctuation  ', numpnct)
     print('Num  special characters' , numspec)


Ethan Rosenberg
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor