Memorandum of beginners Python "isdigit" movement

Python is digit movement

It was a memorandum because the content taught by the teacher was interesting. I just learned how to do it and verified it myself, so if you notice that it's wrong here, please let me know.

isdigit returns "integer" of "str type" as True, False.

Feature -True if only str type numbers (integers). (0 is also True, but numbers starting with 0 are errors) -Even with str type numbers, negative numbers are False. (Is the minus considered a letter?) ・ A small number of str-type numbers are False. (False even if the decimal point is 0) ・ Even with str-type numbers, if letters and symbols are mixed, it will be False. (The operation symbol is also False) -For both str type and int type, numbers starting with 0 are SyntaxError. ・ ”Is False. -Characters are False. -Int type numbers are SyntaxError. (Including calculation results) -Numbers other than 0 that start with 0 are AttributeError regardless of the type.

’’’ print('1'.isdigit()) #True print('100'.isdigit()) #True print('0'.isdigit()) #True

print('a'.isdigit()) #False print('10.0'.isdigit()) #False print('2*3'.isdigit()) #False print(''.isdigit()) #False print('11a'.isdigit()) #False print('-1'.isdigit()) #False

print(1.isdigit()) # SyntaxError: invalid syntax print(5%3.isdigit()) # SyntaxError: invalid syntax print(3+4.isdigit()) #SyntaxError: invalid syntax

print(01.isdigit()) #SyntaxError: invalid character in identifier print('01'.isdigit()) #SyntaxError: invalid character in identifier

print('0.1'.isdigit()) # AttributeError: 'float' object has no attribute 'isdigit' print(0.1.isdigit()) # AttributeError: 'float' object has no attribute 'isdigit' ’’’

that's all.

Recommended Posts

Memorandum of beginners Python "isdigit" movement
Memorandum of python beginners About inclusion notation
Python memorandum
Python Memorandum 2
[Python] A memorandum of beautiful soup4
Python memorandum
python memorandum
python memorandum
Python memorandum
python memorandum
Python memorandum
Learn the basics of Python ① Beginners
A memorandum of python string deletion process
Introduction of Python
Python basics memorandum
Memorandum of sed
Python memorandum (algorithm)
Basics of Python ①
Basics of python ①
Copy of python
Python memorandum [links]
Beginners practice Python
Python beginner's note
Introduction of Python
A memorandum of extraction by python bs4 request
Easy understanding of Python for & arrays (for super beginners)
[Answer example (python3)] ABS (AtCoder Beginners Selection) of atcoder
[Data science memorandum] Handling of missing values ​​[python]
Basic story of inheritance in Python (for beginners)
Python Beginner's Guide (Functions)
[Python] Operation of enumerate
Python memorandum numbering variables
python beginners tried to predict the number of criminals
Memorandum of fastText (editing)
memorandum of vi command
python memorandum (sequential update)
Unification of Python environment
Copy of python preferences
Basics of Python scraping basics
Python beginners organize heapsort
[python] behavior of argmax
Usage of Python locals ()
the zen of Python
Summary of pre-processing practices for Python beginners (Pandas dataframe)
Python beginners organize quicksort
Python memorandum (personal bookmark)
Python beginners touch Pytorch (3)
Installation of Python 3.3 rc1
python textbook for beginners
elasticsearch_dsl Memorandum of Understanding
Python basic memorandum part 2
AtCoder Beginners Selection memorandum
Python Dictionary Beginner's Guide
# 4 [python] Basics of functions
Basic knowledge of Python
Sober trivia of python3
Python beginners touch Pytorch (1)
Python beginners touch Pytorch (2)
[Python] Iterative processing_Personal memorandum
Python Beginner's Guide (Introduction)
Basics of python: Output