n | | n | import ast |
| import sys | | import sys |
n | import ast | n | |
| | | |
n | def check_valid_python_code(text): | n | def is_valid_python_with_if(code): |
| try: | | try: |
n | parsed = ast.parse(text) | n | parsed_code = ast.parse(code) |
| for node in ast.walk(parsed): | | for node in ast.walk(parsed_code): |
| if isinstance(node, ast.If): | | if isinstance(node, ast.If): |
| return True | | return True |
| return False | | return False |
| except SyntaxError: | | except SyntaxError: |
| return False | | return False |
t | input_text = sys.stdin.read() | t | code = sys.stdin.read() |
| print(check_valid_python_code(input_text)) | | print(is_valid_python_with_if(code)) |