Python Forum
I don't know what's wrong with this code [Python Console]
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I don't know what's wrong with this code [Python Console]
#2
It's really hard to tell from that code. Please checkout these instructions for using BBCode to post code. Also, please don't use ; to put multiple commands on one line. It makes it much harder to follow your code.

It's not clear to me exactly what the problem is, given how the code was posted. I would note that attempts is an integer, so you don't need to keep using int(attempts) when checking it. On the other hand, guess is a string, so you may want to use int(guess) in the while condition. Generally, I would just convert it once, either by putting int() around the input statement, or with something like guess = int(guess).
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: I don't know what's wrong with this code [Python Console] - by ichabod801 - Dec-22-2019, 06:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  In Console,Python anna17 0 282 Mar-23-2024, 08:24 PM
Last Post: anna17
  I have a code which is very simple but still I cannot detect what's wrong with it max22 1 584 Nov-07-2023, 04:32 PM
Last Post: snippsat
  Something wrong with my code FabianPruitt 5 970 Jul-03-2023, 10:55 PM
Last Post: Pedroski55
  Compiles Python code with no error but giving out no output - what's wrong with it? pythonflea 6 1,740 Mar-27-2023, 07:38 AM
Last Post: buran
  Video recording with Raspberry Pi - What´s wrong with my python code? Montezuma1502 3 1,390 Feb-24-2023, 06:14 PM
Last Post: deanhystad
  Why doesn't this code work? What is wrong with path? Melcu54 7 2,020 Jan-29-2023, 06:24 PM
Last Post: Melcu54
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,824 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  Python Flask Realtime system printout (console) ffmpeg jttolleson 3 3,101 Apr-18-2022, 06:39 PM
Last Post: jttolleson
  Wrong code in Python exercise MaartenRo 2 1,601 Jan-01-2022, 04:12 PM
Last Post: MaartenRo
  The code I have written removes the desired number of rows, but wrong rows Jdesi1983 0 1,682 Dec-08-2021, 04:42 AM
Last Post: Jdesi1983

Forum Jump:

User Panel Messages

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