Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
X value?
#2
Quote:is 4 the only number that has this characteristhic?
Yep.

def chech_num(n):
    if n**n == n + n:
        return 'Ok!'
    else:
        return 'Fail!'


n = float(input('Number: ')) / 2
print(chech_num(n))
To auto check, you can loop through a range of numbers.
Reply


Messages In This Thread
X value? - by MasterGame - Jul-08-2018, 03:46 PM
RE: X value? - by gontajones - Jul-08-2018, 04:05 PM

Forum Jump:

User Panel Messages

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