Write a program to accept a string as input and print the number of consonants in the string.Input:StringOutput:IntegerConstraints1<=length of string <=1000
Question
Solution 1
Sure, here is a Python program that accepts a string as input and prints the number of consonants in the string.
# Function to count the number of consonants in a string
def count_consonants(string):
consonants = 0
for i in range(len(string)):
if string[i].isalpha(): # che
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI
Similar Questions
Write a program in java to accept a number and chech whether it is a palindrome number or not. Do the program without using modulus operator and String.
Write a java program to accept a String and the perform the following operations:a) Count the number of words with the first and the last letter being same.
The program must accept four integers a, b, c and d as input. The program must solve the equation b * c - (a + d) and print it as the output.
Write a Python program to search the numbers (0-9) of length between 1 to 3 in a given string
Given a string as input . Print the frequncy of each character in the string in alphabetical order of characters
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.