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 –