"Is it a good thing ?" ┌──┴──┐ YES NO ↓ ↓ Korea "Can you invented blame an it inferior ?" ┌──┴──┐ ↓ ↓ YES NO ↓ ↓ Problem "Did it Solved happen before 1945 ?" ┌──┴──┐ YES NO ↓ ↓ It's Japan's It's America's fault ! fault !
#!/usr/bin/ruby puts "Is it a good thing ?"; yn=STDIN.gets(); if yn[0]==?y or yn[0]==?Y then puts "Korea invented it.(END)"; else puts "Can you blame an inferior ?"; yn=STDIN.gets(); if yn[0]==?y or yn[0]==?Y then puts "Problem Solved.(END)"; else puts "Did it happen before 1945 ?"; yn=STDIN.gets(); if yn[0]==?y or yn[0]==?Y then puts "It's Japan's fault !(END)"; else puts "It's America's fault !(END)"; end end end
#!/usr/local/bin/python q1='Is it a good thing?' y1='Korea invented it. (END)' q2='Can you blame an inferior ?' y2='Problem Solved. (END)' q3='Did it happen before 1945 ?' y3="It's Japan's fault ! (END)" n3="It's America's fault ! (END)" n = 0 for q in (q1,q2,q3) : print q yn = raw_input('y or n > ') if yn == 'y' : print (y1,y2,y3)[n] break elif n == 2 : print n3 n += 1
10 prnt "Is it a od thing ?" 20 prnt "y/n" 30 input=a$ 40 if a$ "y" or "Y" then goto 60 50 if a$ "n" or "N" then gotu 70 60 prnt "Korea invented it " : end 70 prnt "gennkainida atowo tanomu" :end