from livewires import *

x= read_number()
y= 1234

while x <> y:
print read_number()


Why wont the loop stop when i enter 1234 ? any help greatly appreciated!

Recommended Answers

All 5 Replies

My suggestion, use code tags around your code and stop using livewires, it's an old module and really not Python ...

x = input("Enter an integer number: ")
y = 1234

n = 0
while x <> y:
    print "need", y, "you entered", x
    # limit a possible endless loop
    n += 1
    if n > 10:
        break

I think Blade321 also wants to ask for input if the numbers don't agree and assign it to the variable x (instead of printing it)

x=0
y= 1234
n=0
while x <> y:
   x = int(raw_input("Enter a number " ))
   n += 1
   if n > 10:
       break

What's the issue with livewires?

Jeff

I assume that livewires is just a wrapper for Python and Tkinter using a different syntax. The syntax might be easier to understand for youngsters, but simply adds another layer of potential errors. I don't think very many folks use this module. I am not even sure where to get it?

For instance, does read_number() read an integer or a float, or does it use eval() for both?

Hm. I wonder if it's the same one I've used, which is a wrapper for pygame that works reasonably well; it's out of the Dawson book "Python Prog. for the Absolute Beginner."

Jeff

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.