Most popular tags

304 questions

412 answers

70 comments

329 users

Most active Members
this week:
  1. 15boyntonc - 2 points
  2. 15husbando - 1 points
  3. 15bratbyf - 1 points

Recent Badges

100 Club
- 15arnoldr -
Verified Human
- 15arnoldr -
Nice Question
- 14scotta -
Verified Human
- 15harrisonb -
Good Question
- smartin -
Nice Question
- 14scotta -
Nice Question
- 14scotta -
Nice Question
- 14scotta -
Nice Question
- 14gregoryj -
100 Club
- 15bratbyf -
100 Club
- 15bellc -
100 Club
- 15matereker -
Verified Human
- 15bellc -
Verified Human
- 15bratbyf -
100 Club
- 15agard -
Verified Human
- 15matereker -
Verified Human
- 15agard -
100 Club
- 15gardnerj -
100 Club
- 15houghm -
100 Club
- 15almondi -
100 Club
- 15huddlestonj -
Verified Human
- 15houghm -
Verified Human
- 15almondi -
Verified Human
- 15huddlestonj -
Verified Human
- 15gardnerj -
Verified Human
- 15husbando -
100 Club
- 15wilkinsona -
100 Club
- 15wearh -
100 Club
- 15Barfields -
100 Club
- 15harrisonb -

how to use a decimal in an input

+6 votes
distance1=int(input("How far do you live from SHS in KM?"))

 

this doesnt allow me to use decimals (because of the int) but what is the correct code??
asked Sep 30, 2016 in Python by 14goldinga (710 points)
edited Oct 6, 2016 by 14goldinga

1 Answer

+8 votes
 
Best answer

Use the float() function rather than int() function.

answered Oct 6, 2016 by 14hutchinsona (800 points)
selected Oct 6, 2016 by 14goldinga
NOICE ANSWER
!Noice Reply!
well done guys:)
thanks aidan
we did it reddit!
Welcome to Selby Computing Q&A, where you can ask questions and receive answers from other students in Computer Science.
...