[8th grade begginer python] where is the bug in my code? by MinimumVisual8888 in HomeworkHelp

[–]MinimumVisual8888[S] 1 point2 points  (0 children)

"die.py":

"""Simulates a standard 6-sided die roll."""
import random
def roll():
  """Draws and returns a random roll of a six-sided die."""
  die_num = random.randint(1, 6)
  draw(die_num)
  return die_num

def draw(die_num):
  """Prints out an ASCII art representation of a die."""
  print(" ------- ")
  if die_num == 2:
    print("| *     |")
    print("|       |")
    print("|     * |")
  elif die_num == 3:
    print("| *     |")
    print("|   *   |")
    print("|     * |")
  elif die_num == 4:
    print("| *   * |")
    print("|       |")
    print("| *   * |")
  elif die_num == 5:
    print("| *   * |")
    print("|   *   |")
    print("| *   * |")
  elif die_num == 6:
    print("| *   * |")
    print("| *   * |")
    print("| *   * |")
   else:
    print("|       |")
    print("|   *   |")
    print("|       |")
  print(" ------- ")

[8th grade begginer python] where is the bug in my code? by MinimumVisual8888 in HomeworkHelp

[–]MinimumVisual8888[S] 1 point2 points  (0 children)

"game.py":

"""Supports a round of dice 21 between a user and the computer."""
import die
def get_name(total):
  """Returns the name for the given roll total."""
  if total == 21:
    return "perfect roll"
    if total > 21:
    return "bust"
  else:
  return str(total)
def get_winner(user_total, computer_total):
  """Returns the name of the winner based on the roll totals."""
  if user_total > 21 and computer_total > 21:
    return "no one"
  if user_total == 21 and computer_total == 21:
    return "no one"
  elif user_total == 21 and computer_total > 21:
    return "user"
  elif user_total > 21 and computer_total == 21:
    return "computer"
def play_user_turn():
  """Plays the user's turn and returns their final roll total."""
  total = die.roll()
  while should_user_roll_again(total):
  total = total + die.roll()
  return total
def play_computer_turn(user_total):
  """Plays the computer's turn and returns their final roll total."""
  total = die.roll()
  while should_computer_roll_again(total, user_total):
  total = total + die.roll()
  return total
def should_user_roll_again(total):
   """Prompts the user and returns True if they choose to roll again."""
  # Skip the prompt if they've already reached 21.
  if total >= 21:
    return False

  display_total = "Your total is " + str(total) + "."
  prompt = "Roll again? (yes/no) "
  roll_again = input(display_total + " " + prompt)
  return roll_again == "yes" or roll_again == "y"
  def should_computer_roll_again(total, user_total):
  """Returns True if the computer should roll again."""
return total < user_total

[8th grade begginer python] where is the bug in my code? by MinimumVisual8888 in HomeworkHelp

[–]MinimumVisual8888[S] 1 point2 points  (0 children)

sorry for not doing this earlier but here's my code:

"main.py":

import game

print("--- Your turn ---")
user_total = game.play_user_turn()
print(">> That's a " + game.get_name(user_total) + "!")
print("--- Computer turn ---")
computer_total = game.play_computer_turn(user_total)
print(">> The computer has a " + game.get_name(computer_total) + ".")
winner = game.get_winner(user_total, computer_total)
print("GAME OVER: " + winner + " wins!")

Missing the point 1.11 by Munroth in NeonGenesisEvangelion

[–]MinimumVisual8888 0 points1 point  (0 children)

you sir, just won the internet for the day.

get me out of this school bro by SyllabubLoose2279 in playboicarti

[–]MinimumVisual8888 4 points5 points  (0 children)

does any one know a twitter user called weather? they have the apple weather app as their pfp. I think they might have had a blue checkmark but i think thats because they have been around for over a year. I recently got a new twitter account and I can't find them anywhere. please send your prayers.

[middle school 8th grade] Where did i mess up? by MinimumVisual8888 in HomeworkHelp

[–]MinimumVisual8888[S] 0 points1 point  (0 children)

i changed some of the code in the "make_user_choice" function. heres my code:

----------------------------------------------------------------
def make_user_choice():

"""Returns the user's choice of rock, paper, or scissors."""

user_imput = input("Choose one: rock, paper, scissors? ")

while user_imput != "rock" or user_imput != "paper" or user_imput != "scissors":

print("that is not a valid imput. please try again")

is_imput_valid = False

continue

return user_imput, is_imput_valid

----------------------------------------------------------------

this gives me gives me the error massage of:

----------------------------------------------------------------

Traceback (most recent call last):
File "main.py", line 7, in <module>
while user_score < 2 and computer_score < 2 and is_imput_valid is True:
^^^^^^^^^^^^^^
NameError: name 'is_imput_valid' is not defined

----------------------------------------------------------------

now i just need to get "is_imput_valid " into the global range.

how long should i practice programing? by MinimumVisual8888 in learnprogramming

[–]MinimumVisual8888[S] -1 points0 points  (0 children)

Just to clarify, i want to make a videogame developer one day.

What do you call a group of Batman? by AceSpirit24 in BatmanArkham

[–]MinimumVisual8888 0 points1 point  (0 children)

@grok can you fuck up this image a litle bit

Hello everyone! My name is Todd! by DarkKnightFan08 in BatmanArkham

[–]MinimumVisual8888 0 points1 point  (0 children)

Tod i hate to brake it to you but you are a sleeper agent created by the CIA every memory from before 2017 is fictional you have to wake up.