I'm just learning python and i'm trying to make a game where someone puts in 3 numbers and the program picks one of them at random

import random 
print "Enter 3 numbers and i'll choose 1 at random"

a = 0
b = 0
c = 0

nmlist = [a, b, c]

while 1 == 1: 
    nmlist = [a, b, c]
   
    a = input("first number? ")
    b = input("second number? ")
    c = input("third number? ")

    if (a == int, b == int, c == int):
              print 'picking...'
              s = random.choice(nmlist) + 1
              print s
              

else:
    a = input("first number? ")
    b = input("second number? ")
    c = input("third number? ")

the random part doesn't work... it i can type 1, 2, and 3 and the random number will come out as 4 and 5, 22, 6 got 8

I'm sure there's other problems too so if anyone can help me it'd be great

I streamlined your code a little:

import random

print "Enter 3 integer numbers and i'll choose 1 at random"

while True:
    a = input("first number? ")
    b = input("second number? ")
    c = input("third number? ")
    # put your numbers in a list
    nmlist = [a, b, c]

    if type(a+b+c) == int:
        print 'I picked', random.choice(nmlist)
    else:
        print "Please enter integers only!"
    choice = raw_input("Press Enter to keep going, or enter q to quit: ")
    if choice == 'q':
        break

I assumed you want to enter integers only.

Thanks :)
yes I wanted it to only be integers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.