Stay Hydrated!
BananaSoul (37)

This code will tell you about hydration. You should be sure to drink AT LEAST 10 cups of water a day!

You are viewing a single comment. View All
BananaSoul (37)

If you don't enter a numeral it crashes. Idk why.

3465728974563 (50)

@BananaSoul because it can't read a string that's not a number. Your trying to make it read text but it can't decipher what you're trying to say from just words.

Luxi (8)

@BananaSoul - It is asking for an integer (a whole number), so it looks for one. If your answer is for example 5, it works, but it wouldn't work with "A" as that is not a whole number. Different types are used for code such as;
abc = 1
if abc > 0:
print("abc!")

If instead, it was a string, it wouldn't work; as it couldn't compare a string (probably expecting words like 'And' as the input) to the number '0').

Luxi (8)

@BananaSoul - No problem :) By the way, you can use =< or => to say 'equal to or greater/less than'. Alternatively, you can still use > or < but use the number below the one to encompass all options you want. Example:
slicesOfPizza = 8
if slicesOfPizza => 1:
--slicesOfPizza = slicesOfPizza - 1
else:
--print("All out")

Instead of "=> 1", you can also put ">0". The second would put everything greater than 0, which is 1, 2, 3, etc. just like the first one would.

Just thought I would say, because you did >10 and ==10 as separate functions.

metaflee (1)

@BananaSoul You can raise an exception and tell the interpreter how to handle it. Find the appropriate info on the internet :)