Day 16: Exceptions - String to Integer

  • + 0 comments

    I had to remove the "if name == 'main':"

    #!/bin/python3
    
    import math
    import os
    import random
    import re
    import sys
    
    S = input()
    try: 
        value = int(S) 
        print(value) 
    except ValueError: 
        print("Bad String")