How to set a "null" to 0


#1

I’m trying to create a money calculator, but if someone dont put a number in the raw_input the addition dont work, i want to set “null” to zero

How i do this?


#2

What is null in that context?
If it’s input, then your program doesn’t set the input
If you mean to set a variable to zero when you get “null” as input, that’s something you’d use an if-statement for


#3

The null is when the raw_input ask:

How many (a money value)? and the user dont put a number, just pressing enter


#4

Only way I can read that is that you want:

null = 0

#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.