[issue41436] BUG a simple "and" and "or"

Samran report at bugs.python.org
Wed Jul 29 12:30:45 EDT 2020


New submission from Samran <iamsamran1d at gmail.com>:

#this is the code

from random import randint

num = randint(1,10)

print(type(num))

print(num)

ch = None                                                                                           #tried changing this tried converting types

guess = 0

print(type(guess))

print("Welcome to guessing game: ")

 

 

while ch != 'n' or ch != 'N':                                            #here is the bug this statement is not running. It works with “and”

                while( guess != num):

                                guess = int(input("Enter your guess?  "))

                                if guess == num:

                                                print("You Guessed Congratz")

               

 

                ch=input("Enter 'y' to play or 'n' to exit: ")

               

 

                if ch=='y' or ch == 'Y':

                                guess= 0

                                num = randint(1,10)

 

print("Thankyou for playing.")

----------
components: Tests
files: Command Prompt - python  test.py 29-Jul-20 9_16_22 PM (2).png
messages: 374576
nosy: Samran
priority: normal
severity: normal
status: open
title: BUG a simple "and" and "or"
type: compile error
versions: Python 3.8
Added file: https://bugs.python.org/file49347/Command Prompt - python  test.py 29-Jul-20 9_16_22 PM (2).png

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41436>
_______________________________________


More information about the Python-bugs-list mailing list