[Tutor] Problem in making calulator
Max Noel
maxnoel_fr at yahoo.fr
Fri Feb 18 00:29:17 CET 2005
On Feb 17, 2005, at 23:11, . Sm0kin'_Bull wrote:
> I wrote this to add 2 numbers...
>
> print "Please input data"
> number1 = int(raw_input(" "))
> number2 = int(raw_input("+ "))
>
>
> total = number1 + number2
> print total
>
> raw_input("")
>
> I want to make output like this...
>
> 1 + 1 = 2
>
> But, actually... it looks like this...
>
> 1
> + 1
> 2
Do you really need to do it as the user enters the numbers? Aside from
being a little bit confusing for him, it'd require playing around with
bizarre special terminal control characters to go back one line --
every time the user hits Enter to validate his input, the newline
character is echoed to the terminal and the cursor goes down one line.
-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting
and sweating as you run through my corridors... How can you challenge a
perfect, immortal machine?"
More information about the Tutor
mailing list