Ask coding questions

← Back to all posts
i made a weight converter!
AbdulrahmanDarw (0)

how do i restrict it so they can only input a certain thing like l or k, anyways how bad was it?

Coder100 (18137)

You can't exactly, maybe you could use the getkey module to change user input.

In general, having an error message is helpful, and certainly won't hurt.

AbdulrahmanDarw (0)

@Coder100 ok thanks il look into it i have another question tho why does int have to be before the input?

Coder100 (18137)

because you want to convert it into an int.
otherwise you would turn the string to print to the console into an int and that is not what you want

remember pemdas?
this is what it is @AbdulrahmanDarw

FloCal35 (668)

I don’t think you can