Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

classes in python

fromr random import radint

Asnwer= randint(1,200)
count= 0

while true:
  guess  = getingeger("whatis yourestimate")
  if guess< 1 or guess > 200:
    print(your estimate must be between 1 and 200)
    
    continue
    
  count+ = 1
  if guess < answer:
    print("higher")
  elif guess > answer:
    print("lower")
  else:
    print("you guessed it!")
    
if count== 1
	print("wow first try!!")

  else:
    print("you estimated it in, count,'time'")
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #classes #python
ADD COMMENT
Topic
Name
6+3 =