Method # 1: Using the
p > Exit:
# Python3 demo code
# how to check if a string contains
# only numbers or not p >
# Initializing string
# print the original line
, ini_string1, ini_string2)
# Using isdigit ()
"String1 contains all numbers"
) p >
"String1 doesn`t contains all numbers"
print code >
"String2 conatins all numbers"
" String2 doesn`t contains all numbers "
Initial Strings : 1234556 ab123bc String1 contains all numbers String2 doesn`t contains all numbers
Method # 2: Using Regular Expressions
Initial Strings: 1234556 ab123bc String 1 contains all numbers String2 doesn`t contains all numbers
Method # 3: Using try / exception
Initial Strings: 1234556 abc123 String1 contains only digits String2 doesn`t contains only digits
As the title promises, this book will introduce you to one of the world’s most popular programming languages: Python. It’s aimed at beginning programmers as well as more experienced programmers wh...
This book is not just about learning the code; even if you learn to program. If you want to program professionally, learning to code is not enough; For this reason, in addition to helping you program,...
Learning Correct Cryptography by Example. The interconnected world of the current era has drastically changed everything, including banking, entertainment, and even statecraft. Despite difference...
Spark is one of the hottest technologies in big data analysis right now, and with good reason. If you work for, or you hope to work for, a company that has massive amounts of data to analyze, Spark of...