1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kogti [31]
3 years ago
10

Write a function named word_count that accepts a string as its parameter and returns the number of words in the string. A word i

s a sequence of one or more non-space characters (any character other than ' ').
Computers and Technology
1 answer:
Hatshy [7]3 years ago
4 0

Answer:

def word_count(words):

   return len(words.split(" "))

print(word_count("This is Python."))

Explanation:

*The code is in Python.

Create a function called word_count that takes one parameter, words

Split the words using split function, use " " for the delimiter, and return the length of this using len function.

Note that split function will give you a list of strings that are written with a space in the words. The len function will just give you the length of this list.

Call the word_count function with a string parameter and print the result.

You might be interested in
Providing incentives for customers to learn more about your service is known as?
Julli [10]
B) Advertising is the answer
3 0
3 years ago
Why is audio greyed out on powerpoint ms office 2011?
-BARSIC- [3]
Because its a old type of software and probably wont run on your computer
7 0
3 years ago
What is a dbms in full
Alika [10]

database management system

5 0
3 years ago
What was named the worst game ever?
Schach [20]

Answer:

Fortnight

Explanation:

7 0
3 years ago
Read 2 more answers
What is the difference between the Paste Special and Paste Link options?
kotegsom [21]
Paste Link lets you automatically update the referenced document.
8 0
3 years ago
Read 2 more answers
Other questions:
  • To write 10 lines of code on paper:
    10·1 answer
  • file Assume that a prototype of the part above was built from several cubes. The total volume of the part is 0.54675 in.3. What
    6·1 answer
  • Kaitlin likes a particular design theme, but she is not sure about every single color for bullets, backgrounds, etc found in the
    5·2 answers
  • Create a calendar named fitness and then display it in a calendar view with the default calendar.
    15·1 answer
  • How to use github to creat a blog?Thank you
    10·1 answer
  • I need someone to transfer this into a database in excel Please help :D 7 pts
    15·1 answer
  • Q: Why can't I log in to Brainly
    13·1 answer
  • Choose all stages of the information processing cycle.
    12·2 answers
  • Write a program that prompts the user to enter three words. The program will then sort the words in alphabetical order, and disp
    14·1 answer
  • I want the answer of this task ( using prolog language ) ASAP because the deadline is tomorrow. Please help :"
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!