Improving the efficiency of my simple program

I just learned Python two days ago, so this is probably pretty bad. Since I want to improve in optimization and organization, is there anything particularly bad here or that I can improve. Lost lines of code, everything is done in more memory intensive than it could be, and so on. Thanks so much for any input and I look forward to learning more.

from random import*
b = 10
a = randint(1,b)
point = 1
x = 1
while x < 2:
    print("Guess a number between 1 and ", b)
    svar = int (input())
    if svar == a:
            b+=5
            point= point+point
            a = randint (1,b)
            print("You have ", point, "points!")
    elif svar < a:
            print("Higher")
    else:
            print("Lower")

      

+3


source to share





All Articles