|
|
|
|
|
by vorg
4066 days ago
|
|
Unfortunately, Chinese Python maps English words to 2-character Chinese words, so the translation requires spaces between the Chinese words. So while running:
guess = int(raw_input('Enter integer: '))
if guess == number:
print 'Congratulations'
running = False
elif guess < number:
print 'No, higher'
else:
print 'No, lower'
translates to 當 運行:
猜測 = 整數(輸入('輸入數字: '))
如果 猜測 == 數字:
印出 '恭喜'
運行 = 假
假使 猜測 < 數字:
印出 '錯了, 再大'
否則:
印出 '錯了, 再小'
But if we map English words in programming to single Chinese characters, we wouldn't need spaces, so perhaps 當運:
猜=整(輸('輸入數字: '))
如猜==數:
印'恭喜'
運=假
否如猜<數:
印'錯了, 再大'
否:
印'錯了, 再小'
And if we made the syntax more C-like to fully make use of the spaceless syntax 當運{
猜=整(輸('輸入數字: '))
如猜==數{印'恭喜';運=假}
否如猜<數{印'錯了, 再大'}
否{印'錯了, 再小'}
}
One could program on one's smartphone screen on the train! |
|