Anzeige
Write a program whose input is a string which contains a cha.pdf
Nächste SlideShare
Complete a program that creates an object of the Count class- takes th.pdfComplete a program that creates an object of the Count class- takes th.pdf
Wird geladen in ... 3
1 von 1
Anzeige

Más contenido relacionado

Más de vivekemailid(20)

Anzeige

Write a program whose input is a string which contains a cha.pdf

  1. Write a program whose input is a string which contains a character and a phrase, and whose output indicates the number of times character appears in the phrase Ex: If the input is the output is: Ex if the input is: z. Today is Monday the output is: Ex: If the input is: n It's a sunny day the output is: 2 Case matters. Ex. If the input is: n Nobody the output is:main.py Load defunht templatn ... Type your code here. def count_char(char, phrase): count =0 for c in phrase: if c= char: count +1 return count 9 input_str| = input("Enter Charater and Phrase: ") 10 char, phrase = input_str. split(maxsplit = 1) 11 count = count_char(char, phrase) 12 print (count) Run your program as often as youd like, before submitting for grading, Below, type any needed input values in the first box, then click Run program and observe the programs output in the second boxProgram output displayed here
Anzeige