Building a Smart IDE: Programming Language Detection Discussions | Regex | HackerRank

Building a Smart IDE: Programming Language Detection

  • + 0 comments
    import re
    import sys
    
    code = sys.stdin.read()
    
    if re.search("#include<stdio.h>", code) is not None:
        print("C")
    elif re.search("import java.io", code) is not None:
        print("Java")
    else:
        print("Python")