Python Forum
Get input directly as a number?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get input directly as a number?
#1
In my little, amateurish Python routines, I often need to get a number as input, so I do:

Quote:num = input('just enter a number ')
startNum = int(num)

Today, I just thought, "Is it possible to get a number directly?"

Is it?
Reply


Messages In This Thread
Get input directly as a number? - by Pedroski55 - May-05-2020, 10:56 AM
RE: Get input directly as a number? - by anbu23 - May-05-2020, 11:13 AM
RE: Get input directly as a number? - by deanhystad - May-05-2020, 04:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Import XML file directly into Excel spreadsheet demdej 0 873 Jan-24-2023, 02:48 PM
Last Post: demdej
  How to load log.txt directly into python codes? sparkt 6 3,004 Aug-21-2020, 03:51 PM
Last Post: sparkt
  if the input is not number, let user input again teatea 14 8,850 Jun-02-2020, 07:03 PM
Last Post: ibutun
  TypeError indexing a range of elements directly on the list JFerreira 2 2,225 Mar-30-2020, 04:22 PM
Last Post: bowlofred
  Find Average of User Input Defined number of Scores DustinKlent 1 4,344 Oct-25-2019, 12:40 AM
Last Post: Larz60+
  How to modify __init__ of built-in module directly from the script? sonicblind 5 3,588 Jul-31-2018, 12:48 PM
Last Post: sonicblind
  Why do we use __main__ when we can call a function directly? Dave7Swift 5 3,879 Jun-04-2018, 05:01 AM
Last Post: Dave7Swift
  How can i restrict the number of characters in an input? kevencript 1 4,097 May-23-2018, 05:14 AM
Last Post: micseydel
  Guess Random Number Why i m not able to enter input Nithya Thiyagarajan 6 8,261 Jan-07-2018, 04:26 AM
Last Post: squenson
  Beginner question: help ensuring input is a number ycrad 2 2,932 Dec-23-2017, 10:49 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020