我不知道为什么我的代码不给我一个输出。
我的守则是:
import random
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
---.__(___)
'''
#Write your code below this line
ask_user = input("What Wuould You Choose , ROCK , PAPER, SCICORS\n")
ask_user_low = ask_user.lower
if ask_user_low == 'rock':
ask_user = rock
if ask_user_low == 'paper':
ask_user = paper
if ask_user_low == 'scissors':
ask_user = scissors
possibe_choice = [{rock},{paper},{scissors}]
ai_choice = random.choice(possibe_choice)
if ai_choice == rock and ask_user == paper:
print(f"ai: {ai_choice} \n you:{ask_user} \n you win!")
elif ai_choice == rock and ask_user == scissors:
print(f"ai: {ai_choice} \n you:{ask_user} \n you loose!")
elif ai_choice == paper and ask_user == scissors:
print(f"ai: {ai_choice} \n you:{ask_user} \n you win !")
elif ai_choice == paper and ask_user == rock:
print(f"ai: {ai_choice} \n you:{ask_user} \n you loose !")
elif ai_choice == scissors and ask_user == rock:
print(f"ai: {ai_choice} \n you:{ask_user} \n you win !")
elif ai_choice == scissors and ask_user == paper:
print(f"ai: {ai_choice} \n you:{ask_user} \n you lose!")
elif ai_choice == ask_user:
print(f"ai:{ai_choice}\n you:{ask_user} \n TIE!")
else:
print("Not A Choice Try Again :/")
这里怎么了?
发布于 2022-09-04 01:58:55
ask_user.lower
应该是ask_user.lower()
。
lower
是一个方法(您从不调用它),因此您实际上是在将字符串与方法本身进行比较。
https://stackoverflow.com/questions/73596376
复制相似问题