Hope you are doing well
input() : used with python 3
raw_input() : used with python 2
Purpose of both the function are same.
Kindly find the correct code as below:
import re
#s = 'abcdef12'
s = raw_input('enter the combination: ')
wcount = 0
ncount = 0
ncount = sum(c.isdigit() for c in s)
wcount = sum(c.isalpha() for c in s)
print "number of letters in the string is", wcount
print "number of digits in the string is ", ncount
Hope this resolves your query
In case of any further issue,feel free to revert.
Kindly give your valuable feedback by clicking on any one of the smiley's below.
In case of any further issue,feel free to revert.
Kindly give your valuable feedback by clicking on any one of the smiley's below.
Regards
Sumit Anand
edureka! Solution Team
Website - www.edureka.co
Edureka claims 1st position at Deloitte's Technology Fast 50 India 2014
219471