vendredi 2 janvier 2015

Why do I get this error in Python? [migrated]


I’m making a program where if a user enters text it will convert any caps into lowercase:



def lowerChar(char):
if ord(char) >= 65 and ord(char) <= 90:
char = int(ord(char)) + 32
char = (chr(char))
return print(char)
else:
return print(char)

def lowerString(string):
x = len(string)
for i in range(x):
char = string[0 + i]
lowerChar(char)
result = ""
result = result + lowerChar(string[i])

string = input("type")
lowerString(string)


The error is:



Traceback (most recent call last):
File "C:\Python34\njn.py", line 24, in <module>
lowerString(string)
File "C:\Python34\njn.py", line 19, in lowerString
result = result + lowerChar(string[i])
TypeError: Can't convert 'NoneType' object to str implicitly


Any help will be appreciated.





Aucun commentaire:

Enregistrer un commentaire