'File "Solution.py", line 41, in <module> fptr.write(result + '\n') TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
def getPhoneNumber(s):
# Write your code here
ref_dict = {
'one' : '1',
'two' : '2',
'three' : '3',
'four' : '4',
'five' : '5',
'six' : '6',
'seven' : '7',
'eight' : '8',
'nine' : '9',
'zero' : '0'
}
conversion = ''.join(ref_dict[ele] for ele in s.split())
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
s = raw_input()
result = getPhoneNumber(s)
fptr.write(result + '\n')
fptr.close()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
