Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've written a code, but I can't figure out where I've gone wrong. Can someone help? Thanks a million.

CODE -

import random
guess =0
count =0
x = random.randint(1,10)
while guess!=x:
    count= count+1
    guess=int(input("What number do you guess?"))
if guess < 4:
    print('You took', count,'guesses. You are lucky.')
if guess = 5:
    print('You took', count,'guesses. You are Mr Average.')
if guess > 5:
    print('You took', count,'guesses. You are a loser.')
share|improve this question

put on hold as off-topic by BCdotWEB, Pimgd, Mast, SuperBiasedMan, janos yesterday

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions containing broken code or asking for advice about code not yet written are off-topic, as the code is not ready for review. After the question has been edited to contain working code, we will consider reopening it." – BCdotWEB, Pimgd, Mast, SuperBiasedMan, janos
If this question can be reworded to fit the rules in the help center, please edit the question.

4  
Welcome to Code Review! Broken code is off topic here, so I'd recommend you post your question to Stack Overflow. Keep in mind that you should include a detailed description of what you want your code to do, what it is doing right now, any error messages you're getting and what you have tried to solve the problem. The more of those you include, the faster you'll get a response that'll answer your question. – Pimgd yesterday