import random
print ("hello")
user_friend1 = raw_input("Name one of your friends: ")
user_friend2 = raw_input("Name another friend: ")
# inputs for user
friends = [user_friend1,user_friend2]
best_friend = random.sample(friends, 1)
我想循環播放,這樣,如果用戶鍵入一個問題一個整數,然後它會再次提出這樣的問題,我需要它,這兩個問題user_friend
1和2我怎麼說,如果變量=任意整數,在Python 2倍
print ("your best friend is %s") % (best_friend)
[谷歌](http://stackoverflow.com/q/3501382/1790644)嗎? –
'if type(variable)== int:#do something' –
'isinstance(variable,int)'會更pythonic,不是嗎? @JoshuaNixon –