Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
REVIEW
#1
Well I've made a small, simple, program in Python, can anyone tell me how to make it better, I'm still a nube.

Program:

import sys
Import random

U = True

while True:
Indent>> X = (random.randint(1,50))
Indent>> Y = (random.randint(60,100))
Indent>> Z = (random.randint(20,40))
indent>> A = (random.randint(X, Y))

Indent>> X2 = str(X)
Indent>> Y2 = str(Y)
Indent>> Z2 = str(Z)
Indent>> A2 = str(A)

Indent>> guess_count = 0

Indent>> answer = str(random.randint(X, Y)

indent>> Guess3 = (" and ")
indent>> Guess4 = (" guesses")
indent>> Guess2 = (". What do you think it is? You have ")
indent>> Guess1 = ("I'm thinking of a number between ")
indent>> Guess = (Guess1 + X2 + Guess3 + Y2 + Guess2)
indent>> second_guess = (Z2 + Guess4)
Indent>> Player = (Guess + second_guess)
indent>> print(Player)

Indent>> while guess_count < Z:
DoubleIndent>> checked = ("Guess" + ":")
doubleindent>> check = input(checked)
doubleindent>> guess_count = guess_count + 1

DoubleIndent>> if check < A2:
TripleIndent>> print("Go Higher")

Doubleindent>> if check > A2:
TripleIndent>> print("Go Lower")

DoubleIndent>> if check == A2:
TripleIndent>> break

DoubleIndent>> if check == A2:
TripleIndent>> guess_count = str(guess_count)
TripleIndent>> print("Cool, you guessed the number in", guess_count, "tries")
TripleIndent>> print("")

DoubleIndent>> if check != A2:
TripleIndent>> print("Nope, the number I was thinking of was", A2)
TripleIndent>> print("")


Heart
Reply


Messages In This Thread
REVIEW - by Code_Z - Nov-23-2017, 08:03 PM
RE: REVIEW - by sparkz_alot - Nov-23-2017, 11:27 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020