Thanks. And what do you infer from these? Let’s look at the code and the
output together. I’ll Intersperse them below:
licensekey = input("Enter License Key")
print( type(licensekey), repr(licensekey) )
<class 'str'> ' 824'
This shows us that you’ve entered the string ' 824'.
licensekey = 824
Then you completely forget what you entered, and just set licensekey
to 824. Which is fine for debugging to see what an 824 does. But
better is to convert the string you entered into an integer. See my
earlier post.
print( type(licensekey), repr(licensekey) )
<class 'int'> 824
This shows us that licensekey is now an int (an integer) with value
824 (notice that there are now no quote marks - this is a number, not
a string).
if licensekey>=824:
print("license key invalid rerun and try again")
license key invalid rerun and try again
This shows us that we took the “true” branch of the if-statement. That
is because your test licensekey>=824 evaluated as true. Since
licensekey is 824, we are testing: 824>=824. That looks true to
me.
If this should not have taken the “true” branch, how do you think the
test should be changed so as to produce “false”?