Answered step by step
Verified Expert Solution
Link Copied!

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 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:
>count_hypens ()
Please enter a string: Hello-World
What is the purpose, parameters and return in this question?
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions