None when the text does not convert to an integer
Write code · Basic · §13.2 A program that doesn't crash
Complete the function to_change(text), which converts text, the text from a "daily follower change" field, to an integer and returns it. If the text cannot be converted to an integer, return None. Catch only one error: the ValueError raised when the conversion fails. Do not catch other errors, such as those caused by a value that is not a string; leave them as they are.
Starter code
def to_change(text):
# Write your code here
pass
print(to_change("12"), to_change("-5"), to_change("unknown"))Solve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.