Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 counthyphens 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
def counthyphens int:
# YOUR IMPLEMENTATION
Examples of the function running should appear as follows:
counthypens
Please enter a string: HelloWorld
What is the purpose, parameters and return in this question?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started