Python program not running

I tried going through the first Beau Canes course for Python beginners on Youtube. I entered the code in the Replit browser for the “rock paper scissors” game and the program isn’t running. No error message. Is there any way to get support for this course. Right out of the gate, I’m dead in the water. Thanks folks.

Jim

Thanks for the reply Randell. At this point in the exercise, when I run the code, the console should be asking for input like this- input("Enter a choice (rock, paper, scissors: "). Instead, all I get is a cursor. That’s it. No error, nothing. I’ve checked for typos multiple times. Here’s the Replit link:

https://replit.com/@jcamp2875/JimsReplit#main.py

Here’s the code so far:

import random

def get_choices():
  player_choice = input("Enter a choice (rock, paper, scissors: ")
  options = ["rock", "paper", "scissors"]
  computer_choice = random.choice(options)
  choices = {"player": player_choice, "computer": computer_choice}
  return choices

def check_win(player, computer):
  print(f"You chose {player}, computer chose {computer}")
  if player == computer:
    return "It's a tie!"

Whoops, sorry. Here’s the Replit Link- JimsReplit - Python Repl - Replit

Thanks. Jim

So line #4- player_choice = input("Enter a choice (rock, paper, scissors: ") calls the function “input” which passes the text string argument (“Enter a choice (rock,paper,scissors.”) and assigns the response to the variable “player_choice,” no? Didn’t I call the function “input?” Thanks for your help.

Got it. Thanks. Program is now generating an error for the check_win function- “TypeError: ‘function’ object is not subscriptable” Is that a typo or something else?
Thanks again for your help…

Also take care of indentation… a function in python looks like:

def my_function():
    #some code here 
    return 
1 Like

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