Загрузка...

🔥 Python Interview Question | Check Digits in String? #techshorts #education

Python Interview Question 🔥

How do you check if a string contains only digits in Python?

Options:
1️⃣ str.isdigit()
2️⃣ str.isalnum()
3️⃣ str.isalpha()
4️⃣ str.islower()

✅ Correct Answer: str.isdigit()

The isdigit() method returns True if all characters in the string are digits, otherwise it returns False.

Example:

text = "12345"
print(text.isdigit())

Output:

True

Follow for more Python Interview Questions & Coding Tips 🚀

📢 Join My Community

👉 YouTube: https://www.youtube.com/@learn.pywithradhe

👉 Instagram: https://www.instagram.com/learn.pywithradhe

👉 Telegram: https://t.me/learnpywithradhe

👍 Like 👍 Share 🔁 Subscribe 🔔

#️⃣ Hashtags

#python
#pythoninterviewquestions
#pythonmcq
#learnpython
#pythonprogramming
#codinginterview
#pythontips
#datascience
#machinelearning
#coding

Видео 🔥 Python Interview Question | Check Digits in String? #techshorts #education канала LearnPy
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять