简体   繁体   中英

if statement only works inside loops

so I am trying to make a simple rock paper succors program but im having a problem with a bug where any if statements that are not in a while loop do not work. here is my current code and by the way I know the indentation may look off but that is what the editor is automatically telling me to do

import random

computer_choice = random.randint(1,3)
player_choice = int(input("rock paper or siccers. 1. for rock 2. for paper 3. for siccors")


if player_choice == computer_choice:
                    print("it is a tie.")

so I am trying to make a simple rock paper succors program but im having a problem with a bug where any if statements that are not in a while loop do not work. here is my current code and by the way I know the indentation may look off but that is what the editor is automatically telling me to do

import random

computer_choice = random.randint(1,3)
player_choice = int(input("rock paper or siccers. 1. for rock 2. for paper 3. for siccors")


if player_choice == computer_choice:
                    print("it is a tie.")

so I am trying to make a simple rock paper succors program but im having a problem with a bug where any if statements that are not in a while loop do not work. here is my current code and by the way I know the indentation may look off but that is what the editor is automatically telling me to do

import random

computer_choice = random.randint(1,3)
player_choice = int(input("rock paper or siccers. 1. for rock 2. for paper 3. for siccors")


if player_choice == computer_choice:
                    print("it is a tie.")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM