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:
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

Step: 3

blur-text-image

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

Building The Data Lakehouse

Authors: Bill Inmon ,Mary Levins ,Ranjeet Srivastava

1st Edition

1634629663, 978-1634629669

More Books

Students also viewed these Databases questions

Question

4. Identify cultural variations in communication style.

Answered: 1 week ago