Robotics & Artificial Intelligence
Write a Python program to count the number of vowels in a given string. Your program should do the following:
- Define a string.
- Traverse the string and count the vowels (a, e, i, 0, u) using a loop.
- Print the total count of vowels.
Python String Manipulation
1 Like
Answer
st = "Artificial Intelligence"
count = 0
for ch in st:
if ch in 'aeiouAEIOU':
count += 1
print("Total number of vowels:", count)Output
Total number of vowels: 10
Answered By
2 Likes
Related Questions
Discuss any two advantages of visualising motion in a robot design. State any one use of Tinkercad.
What are the different types of sources of data from where we can collect reliable and authentic datasets?
Briefly explain the 4Ws of the Artificial Intelligence project cycle.
What is Evaluation in stages of Artificial Intelligence project cycle?