#WSQ06

#WSQ06
i used a while and a module random, this page help me: http://www.mclibre.org/consultar/python/lecciones/python_while.html
http://www.pythondiario.com/2013/06/modulo-random-en-python-con-ejemplos.html

and here is the link to git hub: https://github.com/juanheuforico/mastery/blob/master/pick.py

import random
p=random.randrange(100)

con=1
print(“I have a number chosen between 1 and 100.”)
r=int(input(“Please guess a number between 1 and 100: “))
#print=random.randrange(100)
while r != p:
    if r < p:
        r=int(input(“the number that you are searching is morehigh “))
    if r > p:
        r=int(input(“the number that you are searching is lower “))
    con=con+1
print(“You got it! The right answer is indeed “,r)
print(“you do “,con,”trys”)

#WSQ06

CC BY 4.0 #WSQ06 by Juan Antonio Olvera Robles is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.