Can i restrict the user to a certain range in the input function itself? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can i restrict the user to a certain range in the input function itself?

Directly I want to take the input in a certain range with out checking it again if it falls in that range! Thanks in advance😊

25th Feb 2019, 12:10 PM
Vanga Balaji Ravi Teja
Vanga Balaji Ravi Teja - avatar
4 Answers
+ 1
You can't explicitly restrict the user from giving inputs in a range. Rather, you can show a message that input must be in the range or use mod(%).... May be?
25th Feb 2019, 6:35 PM
Шащи Ранжан
Шащи Ранжан - avatar
+ 1
okay! may be in few cases... any way thanks bro
25th Feb 2019, 6:44 PM
Vanga Balaji Ravi Teja
Vanga Balaji Ravi Teja - avatar
0
mod(%) in the sense how can we do that? can you be more specific... i'm new to coding
25th Feb 2019, 6:40 PM
Vanga Balaji Ravi Teja
Vanga Balaji Ravi Teja - avatar
0
I don't think I'd be of much help. Like, if you want to get number in range 0-4 then you can take number%5 which will always make the number between 0-4.
25th Feb 2019, 6:42 PM
Шащи Ранжан
Шащи Ранжан - avatar