
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Write a program in Python to verify kth index element is either alphabet or number in a given series
Input − Assume, you have a Series,
a abc b 123 c xyz d ijk
Solution
To solve this, we will follow the steps given below −
Define a Series
Get the index from user
Set the if condition to check the value is digit or not. It is defined below,
if(data[x].isdigit()): print("digits present") else: print("not present")
Example
Let us see the following implementation to get a better understanding.
import pandas as pd dic = {'a':'abc','b':'123','c':'xyz','d':'ijk'} data = pd.Series(dic) x = input("enter the index : ") if(data[x].isdigit()): print("digits present") else: print("not present")
Output
enter the index : a not present enter the index : b digits present
- Related Articles
- Write a program in Python to find the index for NaN value in a given series
- Write a program in Python to slice substrings from each element in a given series
- Write a program in Python to print numeric index array with sorted distinct values in a given series
- Write a program in Python to replace all odd index position in a given series by random uppercase vowels
- Write a program in Python to filter valid dates in a given series
- Write a program in Python to filter armstrong numbers in a given series
- Write a program in Python to find the most repeated element in a series
- Closest Pair to Kth index element in Tuple using Python
- Write a program in Python to find the missing element in a given series and store the full elements in the same series
- Write a Python program to shuffle all the elements in a given series
- Write a program in Python to generate five random even index lowercase alphabets in a series
- Write a program in Python to filter only integer elements in a given series
- Write a program in Python to round all the elements in a given series
- Write a program in Python to print the most frequently repeated element in a series
- Write a program in Python to transpose the index and columns in a given DataFrame

Advertisements