-6

I just want to know how can i check it is number or not in import sys situation. and want to know Why i didn't get output "Hello" with code A.isalpha()

enter image description here

azro
  • 53,056
  • 7
  • 34
  • 70
  • 1
    Hi! Welcome to SO. Please read [how to ask a good question](https://stackoverflow.com/help/how-to-ask). Please your code as text, not as an image; remember to format it. – miquelvir Mar 28 '21 at 10:24
  • 1
    Please have a look at https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-on-so-when-asking-a-question – Thierry Lathuille Mar 28 '21 at 10:30

1 Answers1

2

The method A.isalpha() returns a boolean value True or False not a string "True", you compare booleans like this

if A.isalpha() is True: 
    print("hello")

But as a if expects a boolean statement, the return value from isalpha is already good

if A.isalpha():
    print("hello")
azro
  • 53,056
  • 7
  • 34
  • 70
  • just one more question. i don't understand the difference between == and is when i use if statement. sorry for low level question. – John Kang Mar 28 '21 at 10:47
  • @JohnKang here `==` could also be used, but still with `True`, I let you read https://stackoverflow.com/questions/132988/is-there-a-difference-between-and-is or google *python is or ==* for mor details – azro Mar 28 '21 at 10:50