import math defisPrime(n): if n <= 1: returnFalse for i inrange(2, int(math.sqrt(n)) + 1): if n % i == 0: returnFalse returnTrue
defgcd(m,n): return m ifnot n else gcd(n, m%n)
ans='' f = open("que.txt", "r") for i inrange(609): question = f.readline() f.readline() # eat question=question.strip('\r\n\t') question=question.replace('?','') question=question.replace('.','') piece=question.split() iflen(piece) == 5and piece[3] == 'prime': if(isPrime(int(piece[1]))): ans+='answer=true&' else: ans+='answer=false&' eliflen(piece) == 10and piece[3] == 'greatest': ans+='answer='+str(gcd(int(piece[7]),int(piece[9])))+'&' eliflen(piece) > 9and piece[4] == 'word': tmp=piece[3].replace('th','') tmp=tmp.replace('st','') tmp=tmp.replace('nd','') tmp=tmp.replace('rd','') offset=int(tmp) ans+='answer='+piece[8+offset]+'&' elif question=='What is the capital of Germany': ans+='answer=Berlin&' elif question=='What year is it': ans+='answer=2018&' elif question=='What color is the sky': ans+='answer=blue&' elif question=='Who directed the movie Jaws': ans+='answer=Steven Spielberg&' elif question=='What is the capital of Hawaii': ans+='answer=Honolulu&' elif question=='What is the tallest mountain on Earth': ans+='answer=Mount Everest&' elif question=='Which planet is closest to the sun': ans+='answer=Mercury&' elif question=='How many planets are between Earth and the Sun': ans+='answer=2&' elif question=='How many strings does a violin have': ans+='answer=4&' else: print(question) ans+='answer='+input()+'&' f.close()
ans+="submit=Submit+Answers" f = open("res.txt", "w") f.write(ans) f.close()