User Profile

Collapse

Profile Sidebar

Collapse
am5243
am5243
Last Activity: Sep 28 '15, 03:26 PM
Joined: Sep 22 '15
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • am5243
    started a topic Infinite loop?

    Infinite loop?

    I am a beginner to Python and am just trying to make a simple 'Guess the number' game. I programmed it to tell you weather the number you guessed is higher or lower than the actual number. However, the 'Higher' and 'Lower' appear on the screen a couple of hundred times instead of just one.

    Code:
    import random
    
    print('Welcome to Guess the Number')
    print('Try to guess the number in as few tries as possible')
    ...
    See more | Go to post

  • Thanks! I tried that and it worked straight away :)
    See more | Go to post

    Leave a comment:


  • AttributeError: 'module' object has no attribute 'randit'

    Code:
    import random
    
    print('Welcome to Guess the Number')
    print('Try to guess the number in as few tries as possible')
    
    the_number= random.randit(1, 100)
    
    guess=int(input('Take a guess!  '))
    tries=1
    
    
    while guess != nbum:
              if guess>the_number:
                  print('Lower... ')
    
    
    else:
              print('Higher...
    ...
    See more | Go to post
No activity results to display
Show More
Working...