Python Forum
what does x reprsent in this code ?
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
what does x reprsent in this code ?
#17
what if i have this code:

x = int(input('enter a number: '))

if x == 7:

    print('x equals 7')

else:

    print('input does not equal 7')
very simple right, but what if the user presses 'enter' or 7.7 or 'abc'...
then i get an error, so how do i replace it with some response ?
Reply


Messages In This Thread
RE: what does x reprsent in this code ? - by buran - Apr-09-2020, 02:25 PM
RE: what does x reprsent in this code ? - by buran - Apr-10-2020, 07:20 PM
RE: what does x reprsent in this code ? - by astral_travel - Apr-19-2020, 01:43 PM
RE: what does x reprsent in this code ? - by buran - Apr-19-2020, 01:49 PM

Forum Jump:

User Panel Messages

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