You are viewing a single comment's thread. Return to all comments →
i dont know why my answer is wrong the output ic correct-#!/bin/python3
import sys
if name == 'main': S = input().strip() # Read input and strip leading/trailing whitespaces
try: # Try to convert the string to an integer print(int(S)) except ValueError: # If it fails, print "Bad String" print("Bad String")
Seems like cookies are disabled on this browser, please enable them to open this website
Day 16: Exceptions - String to Integer
You are viewing a single comment's thread. Return to all comments →
i dont know why my answer is wrong the output ic correct-#!/bin/python3
import sys
if name == 'main': S = input().strip() # Read input and strip leading/trailing whitespaces