Python Forum
A problem with defining variables
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A problem with defining variables
#4
You can use int() built-in function

x = int(raw_input('write first number: '))
this is basic example. it will raise and exception in case of invalid input
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
A problem with defining variables - by meru120 - Jan-30-2019, 11:46 AM
RE: A problem with defining variables - by buran - Jan-30-2019, 11:59 AM
RE: A problem with defining variables - by meru120 - Jan-30-2019, 12:14 PM
RE: A problem with defining variables - by GulaLai - Apr-16-2019, 02:55 PM
RE: A problem with defining variables - by buran - Jan-30-2019, 12:52 PM
RE: A problem with defining variables - by buran - Apr-16-2019, 03:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem defining a variable rix 6 3,290 Dec-17-2019, 11:34 AM
Last Post: rix
  problem using exec to save local variables dkarl 0 1,832 Dec-01-2019, 08:52 AM
Last Post: dkarl
  Problem with variables JCB 3 2,355 Nov-13-2019, 07:20 PM
Last Post: the_ophidian_order
  Problem with defining a function snow_y 4 3,270 Nov-26-2018, 02:13 AM
Last Post: snippsat
  Problem with variables Steffenwolt 4 3,349 Jul-14-2018, 07:27 PM
Last Post: Steffenwolt
  Defining Variables in outside modules Barnettch3 4 3,637 Dec-12-2017, 10:19 PM
Last Post: Larz60+
  [split] Problem using global variables RedSkeleton007 1 2,696 Nov-10-2017, 09:13 PM
Last Post: sparkz_alot
  Vending Machine Program: Problem with variables icabero0225 2 8,558 Jun-08-2017, 11:04 AM
Last Post: buran
  MySQLdb, problem with query with user-defined variables buran 6 6,494 Feb-03-2017, 06:16 PM
Last Post: buran

Forum Jump:

User Panel Messages

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