Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If statement won't print
#1
When I run this code there is no error but it isn't printing match like I want it to. Any idea as to why?

The code is as follows.
while True:
	numbers = 534535345
	barcode = int(input("Barcode: "))
	if numbers == barcode:
		print("match")
#The output prints "Barcode: " like it should, but once I input numbers matching the "numbers" variable I press enter and the #string "match" isn't printed. Also the while loop should repeat but it isn"t.

Output:
Barcode: 534535345
Reply
#2
Works fine for me. Is this your whole code? How exactly are you running it?
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Why doesn't this print statement work? stylingpat 10 5,588 Mar-23-2021, 07:54 PM
Last Post: buran
  Runs perfect in Python but fails to print last statement when converted to .exe. Help sunil422 3 2,747 Aug-13-2020, 01:22 PM
Last Post: deanhystad
  Taking brackets out of list in print statement pythonprogrammer 3 2,338 Apr-13-2020, 12:25 PM
Last Post: perfringo
  capture print statement written in Stored Procedure in SQL Server brijeshkumar_77 0 2,515 Feb-18-2020, 03:22 AM
Last Post: brijeshkumar_77
  printing a list contents without brackets in a print statement paracelx 1 2,081 Feb-15-2020, 02:15 AM
Last Post: Larz60+
  Embedding return in a print statement Tapster 3 2,233 Oct-07-2019, 03:10 PM
Last Post: Tapster
  Quotes and variables in print statement Mark17 4 2,994 Sep-13-2019, 04:07 PM
Last Post: Mark17
  Passing print output into another print statement Pleiades 6 3,091 Sep-08-2019, 02:37 PM
Last Post: Pleiades
  Attribute error print statement error jamshaid1997 1 2,427 Jan-20-2019, 04:02 PM
Last Post: ichabod801
  how to add a coma in print statement of python without preceding space character? brittocj 3 3,085 Sep-27-2018, 09:03 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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