1. Write a Python Numpy program to repeat the words: Python, Numpy and Pandas two times..
The output is:
Original Array: ['Python', 'Numpy', 'Pandas']
Expected Answer:
New array: ['PythonPython' 'NumpyNumpy' 'PandasPandas']
2. Write a Python Numpy program to switch the original array to Capital letter, lowercase and uppercase.
The output is:
Original Array: ['python', 'numpy', 'pandas']
Expected Answer:
New_capitalized: ['Python' 'Numpy' 'Pandas']
New_lower_case: ['python' 'numpy' 'pandas']
New_Upper_case: ['PYTHON' 'NUMPY' 'PANDAS']
3. Write a Python Numpy program to print the string in the center, left-justified and right-justified with length 5 and 10.
The output is:
Original Array: ['python', 'numpy', 'pandas']
Expected Answer:
Center_5_width = ['pytho' 'numpy' 'panda']
Left_5_width = ['pytho' 'numpy' 'panda']
Right_5_width = ['pytho' 'numpy' 'panda']
Center_10_width = ['__python__' '__numpy___' '__pandas__']
Left_10_width = ['python____' 'numpy_____' 'pandas____']
Right_10_width = ['____python' '_____numpy' '____pandas']
4. Write a Python Numpy program to combine two different string a1 and a2 into one phrase.
The output is:
a1 = 'Python'
a2 = ' Exercises'
Expected Answer:
new array: ['Python Exercises']
5. Write a Python Numpy program to include a space in between of initial array.
The output is:
Initial Array = ['python', 'numpy', 'pandas']
Expected Answer:
New Array: ['p y t h o n' 'n u m p y' 'p a n d a s']
6. Write a Python Numpy program to remove the whitespaces of the left side, whitespace of right side and all whitespaces between the initial array.
The output is:
Initial Array = [' python ', ' numpy ', ' pandas ', ' free ', ' exercises ']
Expected Answer:
Initial Array: [' python ' ' numpy ' ' pandas ' ' free ' ' exercises ']
Remove the left side whitespaces : ['python ' 'numpy ' 'pandas ' 'free ' 'exercises ']
Remove the right side whitespaces : [' python' ' numpy' ' pandas' ' free' ' exercises']
Remove the leading and trailing whitespaces: ['python' 'numpy' 'pandas' 'free' 'exercises']
7. Write a Python Numpy program to separate the initial array into their respective words.
The output is:
Initial Array: [' python numpy pandas free exercises ']
Expected Answer:
Separate the element of the intiial array with spaces: [list(['python', 'numpy', 'pandas', 'free',
'exercises'])]
8. Write a Python Numpy program to replace Numpy with Pandas in the initial array.
The output is:
Initial Array = ['Python', 'Numpy', 'Free', 'Exercises']
Expected Answer:
Initial Array: ['Python' 'Numpy' 'Free' 'Exercises']
New Array: ['Python' 'Pandas' 'Free' 'Exercises']
9. Write a Python Numpy program to fill in zero in left side of words with total length of 10 space including the words.
The output is:
Initial Array = ['Python', 'Numpy', 'Free', 'Exercises']
Expected Answer:
Initial Array: ['Python' 'Numpy' 'Free' 'Exercises']
String of 10 digits with zeros: ['0000Python' '00000Numpy' '000000Free' '0Exercises']
10. Write a Python Numpy program to the number of alphabet "e" in the initial array.
The output is:
Initial Array = ['Python', 'Numpy', 'Free', 'Exercises']
Expected Answer:
Initial Array: ['Python' 'Numpy' 'Free' 'Exercises']
Number of 'e': [0 0 2 2]
More Exercises:
Python String ExercisesMore Numpy Exercises:
Numpy String ExercisesMore Pandas Exercises:
Pandas Series ExercisesMore Tutorials:
Python Installation - Linux (Ubuntu)