fork(1) download
  1. # Try a number "5"
  2. # Try a string "test"
  3.  
  4. # Really important conversion function
  5. # Expected Output: Multiplies by two
  6. def theGreatConversion(arg):
  7. return 2 * arg
  8.  
  9. # Main Function
  10. if __name__ == "__main__":
  11. # Get "raw" user input (a string)
  12. input = raw_input()
  13.  
  14. print(input, type(input))
  15.  
  16. # Improper type conversion (string to integer)
  17. if input.isdigit():
  18. input = int(input)
  19. # else: # Uncomment to sanitize silly user input
  20. # # If input was not a number, set to zero (a known safe value)
  21. # input = 0
  22.  
  23. # Apply the really important conversion
  24. output = theGreatConversion(input)
  25. # In this case, print the conversion output
  26. print(output, type(output))
  27.  
Success #stdin #stdout 0.02s 7156KB
stdin
5
stdout
('5', <type 'str'>)
(10, <type 'int'>)