H
H
Hikmat Abdunabiev2016-02-16 16:45:04
Python
Hikmat Abdunabiev, 2016-02-16 16:45:04

How to determine which thousandth range an input number is in Python?

Hello!
I ask you not to kick much, I have been studying python not so long ago.
How can such a problem be solved? There is a certain number entered by the user. There is a thousandth range such as 1000, 2000, 3000, etc. Here's how to determine which range the entered number is in. For example: the number 10 is in the 1000 range, the number 1005 is in the 2000 range, etc.
I hope I was able to explain the issue. Thank you very much in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman Kitaev, 2016-02-16
@Khikmat

['foo', 'bar', 'buzz'][x // 1000]

S
sim3x, 2016-02-16
@sim3x

if 1< x < 1000:  print('foo')
if 1001 < x < 2000: print('buzz')

V
Vladimir Martyanov, 2016-02-16
@vilgeforce

The range number is the number of thousands in the number. Next is high school math.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question