+ 3

Capital letters in python

hey guys I need to write a programm in python, that can determine if there are capital letters,numbers,etc. in string input. for example: input h45i M87Y NAM8E i752s output hi MY NAME is 45878752 thank you very much guys, learning python for few weeks now.

18th Oct 2017, 8:47 AM
dominik
dominik - avatar
3 odpowiedzi
+ 2
what exactly is your task ? filter all numbers from a string and append them on its end ?
18th Oct 2017, 8:50 AM
Chrizzhigh
Chrizzhigh - avatar
+ 2
yes exactly. you write a string composed of a mixture of capital letters, noncapital letters and numbers and it separates them into three groups consisting of either only small letters, capital letters and numbers.
18th Oct 2017, 8:53 AM
dominik
dominik - avatar
+ 1
# this could be a start for you , it seperates the lower upper and digits from the string via list comprehension. inp = input() lowerletters = [i for i in inp if i.islower()] upperletters = [i for i in inp if i.isupper()] numbers = [i for i in inp if i.isdigit()] print(lowerletters) print(upperletters) print(numbers)
18th Oct 2017, 9:03 AM
Chrizzhigh
Chrizzhigh - avatar