-
What is the output of this code?
hashtag = "#Python" hashtag_length = len(hashtag) print(hashtag_length)
-
What is the output of this code?
phone_number = '555-1234' phone_number_length = len(phone_number) print(phone_number_length)
-
When using the len() function in Python, does it count spaces as well?
-
What is the output of this program?
phone_number = '87654321' is_valid_number = phone_number.isdigit() print(is_valid_number)
-
Does Python run this code?
is_valid_number = '87654321'.isdigit() print(is_valid_number)
-
Is the following statement accurate? The len() function in Python is used to check if a string contains only digits. If the string consists solely of digits, the function returns True; otherwise, it returns False.
-
What does the index of a character in a string represent in Python?
-
What is the index of comma?
sentence = "Hello, world!" index = sentence.find(",") print(index)
Python Exercises for Data Types
If you’ve faced difficulties with these exercises, take a look at Data Types Module on my Python course.
You can also share ‘Python Data Types’ Exercises on your:
X (Twitter) – Telegram – Linkedin – Facebook – or on your favorite platform…