The function that counts the number of times a vowel exist in a string is as follows:
def count_vowels(string, dictionary):
vowels = 'aeiou'
dictionary = {}.fromkeys(vowels, 0)
for i in string:
if i in vowels:
dictionary[i] += 1
return dictionary
print(count_vowels("trouble", {}))
<h3>Code explanation.</h3>
The code is written in python.
- we defined a function named "count_vowels". The function accept a string and an empty dictionary.
- Then. we store the vowels in a variable vowels.
- The dictionary is used to store the key value pair i.e the vowels and the number of times they appear.
- We looped through the string.
- If any value in the string is in vowels, we increase the dictionary values by 1.
- Then, we return the dictionary.
- Finally, we call the function with it parameters.
learn more on function here: brainly.com/question/27219031
I believe the answer would be ".docx". It is the file extension used in recent version of microsoft word. These type of files are XML based and are able to have texts, objects and other additions which are stored in separate files and are compressed as one single file.
Answer:
C code is given below
Explanation:
#include<stdio.h>
int main()
{
printf("Input:");
int ch;
int valid=1; // it is set as 1 initially if anything is wrong it is changed to 0
ch=getchar();
if(ch!='#') // it checks if it starts with #
{
valid=0;
}
while((ch = getchar())!= '\n') // this loop runs till line ends
{
if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z')||(ch>='0'&&ch<='9')||(ch=='_')) // if conditions are matched then its okay
{
}
else // else valid is changed to 0 from 1
{
valid=0;
}
}
if(valid==0) // if anywhere there is anything wrong then it prints not valid
{
printf("It is not valid hashtag");
}
else // else prints valid
{
printf("It is a valid hastag");
}
}
C c c c cc c c c cc cc c c c cc c ccc c c c ccc c cc c cc c c c