Strange output (but Ok code)


Lol I randomly got the 7 day Pro free trial somehow and I’m griding though as much as I can. Anyways, I didn’t feel like straying from the original code it told me to do and finally finished. The code works fine, but as I run it, instead of saying what the users input it, it says “You chose <built-in method upper of str object at 0x’9a72721e0>” Must be some simple mistake that I overlook or some syntax that I need to learn though bash.

Any thoughts?

"""This makes a Rock, Paper, Scissors game vs the computer!"""
from random import randint

options = ["ROCK", "PAPER", "SCISSORS"]
message = {
  "tie" : "Yawn it's a tie!",
  "won" : "Yay you won!",
  "lost" : "Aww you lost!"
def decide_winner(user_choice, computer_choice):
  print "You chose %s" % (user_choice)
  print "Computer chose %s" % (computer_choice)
  if user_choice == computer_choice:
    print message["tie"]
  elif user_choice == options[0] and computer_choice == options[2]:
    print message["won"]
  elif user_choice == options[1] and computer_choice == options[0]:
    print message["won"]
  elif user_choice == options[2] and computer_choice == options[1]:
    print message["won"]
    print message['lost']
def play_RPS():
  user_choice = raw_input("Enter Rock, Paper, or Scissors: ")
  user_choice = str(user_choice.upper)
  computer_choice = options[randint(0, 2)]
  decide_winner(user_choice, computer_choice)


calling functions and methods requires parentheses:

# or:


ARG! I knew it was something as simple as that… Thanks!! :sweat_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.