Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to manage an input()
#2
Something like this will get you pointed in right direction (the first part is your code)
import random
secret = random.randint(0,50)
 
message = 'Pick a number from 1 to 49: '
 
even_number = (secret % 2) == 0
 
if even:
    print("The number is even")
else:
    print("The number is odd")
 
attempts = 0
MAX = 5
found = False  
while not found:
    guess = int(input('Enter a guess: '))
    if guess == secret:
        blah
    elif guess > secret:
        blah
    elif guess < secret:
        blah
Reply


Messages In This Thread
how to manage an input() - by rodrigoH - Mar-15-2020, 04:42 PM
RE: how to manage an input() - by jefsummers - Mar-16-2020, 12:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python manage variables across project level mg24 1 933 Nov-12-2022, 05:01 AM
Last Post: deanhystad
  How do you manage script? kucingkembar 14 2,768 Oct-15-2022, 06:32 PM
Last Post: Gribouillis
  Python, how to manage multiple data in list or dictionary with calculations and FIFO Mikeardy 8 2,660 Dec-31-2021, 07:47 AM
Last Post: Mikeardy
  how to manage crypto trading flooding data from exchange servers Mikeardy 0 1,252 Dec-26-2021, 08:31 PM
Last Post: Mikeardy
  API Gateway to manage multiple API's get put data robsuttonjr 2 2,561 Mar-09-2021, 04:09 PM
Last Post: robsuttonjr
  Manage user names in TRAC susja 3 6,061 Dec-06-2020, 09:34 PM
Last Post: susja
  How to manage multiple datasets in Python ThePhantom 2 1,942 May-06-2020, 12:17 AM
Last Post: ThePhantom
  Easier way to manage dependencies? Tylersuard 2 2,369 Jan-01-2020, 09:19 PM
Last Post: Tylersuard

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020