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
Ghella [55]
3 years ago
14

: Write a function "def countWords(string)" that returns a count of all words in an input string represented by the variable 'st

ring'.
Computers and Technology
1 answer:
Zina [86]3 years ago
3 0
We can define a word as a group of characters without a space between them. To find the words of the input string , w can use split(delimiter) which returns a list of strings which had the defined delimiter between them in the input string.

def countWords(string):
words = string.split(" ")
count = len(words)
return count

Here we set the delimiter as the space character, and returned the length of the words list. I split each step into its own line for readability, however the function could be one line:

return len(string.split())

Here, no delimiter is specified. If one isn't given, it will default to split at any whitespace, including space.

You might be interested in
Suppose you will invest $100 per month at the beginning of the month for 40 years with interest rate
Alexeev081 [22]

Answer:

future value = 232369.1361

return % = 384.10 %

Explanation:

given data

principal = $100 per month

time = 40 year = 480 months

rate = 6.25 % yearly = 0.0625 yearly = 0.005208 monthly

to find out

total amount of capital at the end of your investment and percentage is  your total return

solution

so here future value formula is

future value = P \frac{(1+r)^{t-1}}{r} * (1+r)   ..........1

here r is rate and t is time and P is principal

so put all value

future value = 100 \frac{(1+0.005208)^{480-1}}{0.005208} * (1+0.005208)

future value = 232369.1361

so

Total capital at the end of investment-Total principle invested over the years

232369.1361 - 100 ( 12 × 40 )

184369.1361

so

Return % = \frac{184369.1361}{48000} × 100

return % = 384.10 %

5 0
3 years ago
Determina la cilindrada total Vt en un motor de 4 cilindres de 83,6 mm de diàmetre per 91 mm de cursa.
insens350 [35]

Answer:

La cilindrada total del motor es de 1997,025 centímetros cúbicos.

Explanation:

Para determinar la cilindrada total Vt en un motor de 4 cilindros de 83,6 mm de diámetro por 91 mm de carrera se debe realizar el siguiente cálculo, sabiendo que para calcular la cilindrada de un motor se debe utilizar la fórmula ((Pi x Diámetro^2)/4) x Carrera x Número de cilindros = X:

((3.14 x 83.6^2)/4) x 91 x 4 = X

((3.14 x 6,988.96)/4) x 364 = X

(21,945.3344 / 4) x 364 = X

5,486.3336 x 364 = X

1,997,025.4304 = X

1 milímetro cúbico = 0.001 centímetro cúbico

1,997,025.4304 milímetros cúbicos = 1997.0254304000005 centímetros cúbicos

Por lo tanto, la cilindrada total del motor es de 1997,025 centímetros cúbicos.

3 0
3 years ago
What do you call a commercial transaction beyween a buisness and buisness thatis transactedd online?
VMariaS [17]

Answer:

c.B2b digital transaction

Explanation:

yan lang po sana makatulong

6 0
3 years ago
An organization is concerned with the amount of sensor data that is being generated locally, analyzed in the cloud, and returned
Sonja [21]

Answer:

Fog computing

Explanation:

Fog computing or fogging is an decentralized architecture that resides between the cloud and the data source. Fog brings the cloud closer to the data source, that is, it brings resource exploitation, security polices and operational cost closer to the data source.

In our scenario, with fogging in place, the generated sensor data will be preprocessed closer to the local site. The data will preprocessed faster and the quality of the processed data will be greatly increased.

3 0
3 years ago
What is the most common way to perform searches in a search engine?
valina [46]
Using key words is the best way to search things in the search engine. make sure everything is spelled correctly.
5 0
3 years ago
Other questions:
  • A rectangular range of cells with headings to describe the cells' contents is referred to as a
    9·1 answer
  • Universal Containers is implementing a community of High-Volume Community users. Community users should be able to see records a
    12·1 answer
  • The 2 main types of copyright relevant to the recording industry?
    5·2 answers
  • what is the gpa(grade point average) you need to have or you get kicked out of robotics for middle school?
    7·2 answers
  • IOS jail broken or Android unrooted which is better to hack with
    6·1 answer
  • You can rotate a selected graphic by dragging a ________ rotation handle
    13·1 answer
  • Software that was designed to serve the needs of a specific company or organization is called:
    11·1 answer
  • 5.During a recent network attack, a hacker used rainbow tables to guess network passwords. Which type of attack occurred
    9·1 answer
  • Translation of a file into a coded Format that occupies less space than the original file is called
    6·1 answer
  • Write a Python program that uses three variables. The variables in your program
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!