Sign in

季培红 / python-program · Files

GitLab

  • Back to dashboard
  • Project
  • Activity
  • Files
  • Commits
  • Network
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • python-program
  • Guess_num.py
  • init
    08f82566
    季培红 authored
    2017-09-01 18:51:06 +0800  
    Browse Code »
Guess_num.py 232 Bytes
Edit Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14
import random

answer = random.randint(1,100)

n = int(input("Please input a number(1-100):"))

while n!=answer:
    if n>answer:
        n = int(input("More:"))
    elif n<answer:
        n = int(input("Less:"))
print("You win")