Question: Write a function called count _ hyphens that requires no parameters performs the following algorithm: Ask the user for a string using the console (

Write a function called count_hyphens that requires no parameters performs the following algorithm:
Ask the user for a string using the console (terminal)
Required prompt: 'Please enter a string:'
Count the number of hyphens in the string
a hypen is this '-'
Return an integer that is the number of hyphens in the string
printing to the console is not the same thing as returning a value (even though it looks that way in the output examples)
1 def count_hyphens() int:
2 # YOUR IMPLEMENTATION
Examples of the function running should appear as follows:
 Write a function called count_hyphens that requires no parameters performs the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!