Forums

Tarpit, can't run program

Good Morning,

I am in Tarpit mode and am unable to test my number guessing game. Can someone please check to see if my program works? I can't download the actual version of Python at my work computer since it doesn't allow downloads.

Hopefully this paste in correctly:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

import random

print("Hello, and welcome, what is your name?")

 #user will be prompted to input their name

username = input()

print("We are going to try and guess a number between 0 and 100")

print("You have ten tries until you loose.")

def guess (number_to_guess):

    number_to_guess = int(input((username + ", what do you think the number is? ")))
    attempts = 0
    while attempts <= 10:  #IF THE USER ATTEMPTS TO GUESS MORE THAN 10 TIMES, THEN THE USER FAILS
        if number_to_guess < answer:
            print("Too low, try again!")
            attempts += 1
        if number_to_guess > answer:
            print("Too high, try again!")
            attempts += 1
        elif number_to_guess == answer:
            break

    if number_to_guess != attempts:
        print("Too bad, you did not guess the correct number in 10 attempts")

answer = random.randint( 0, 100 )

guess (answer)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Any advice would also be greately appreciated

P.S: I apologize about the way that it is formatted on here!

[edited by admin: formatting]

even when you are tarpitted, you can still run programs. they just run slower.

Edit:

I changed * number_to_guess = int(input(... to number since i can't use the variable in the function.

And thank you Conrad.