n | | n | import sys |
| import ast | | import ast |
n | import sys | n | |
| | | |
n | def is_valid_python_with_if(code): | n | def check_valid_python_code(text): |
| try: | | try: |
n | parsed_code = ast.parse(code) | n | parsed = ast.parse(text) |
| for node in ast.walk(parsed_code): | | for node in ast.walk(parsed): |
| 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 | code = sys.stdin.read() | t | input_text = sys.stdin.read() |
| print(is_valid_python_with_if(code)) | | print(check_valid_python_code(input_text)) |