Urbaeloves7687 Urbaeloves7687
  • 21-11-2019
  • Computers and Technology
contestada

Define a Python function called leng_of_str to calculate the length of a string (Hint: Do not use the len function to find the length of string"" Use for loop to find the length of string.)

Respuesta :

dogacandu
dogacandu dogacandu
  • 22-11-2019

Answer:

The code is attached.

Explanation:

  1. the function accepts string as a parameter
  2. inside fuction there is a caunter variable initialized 0
  3. for every character in the string counter increases by 1
  4. returns final value of i as an integer, which is also the length of the string given

Ver imagen dogacandu
Answer Link

Otras preguntas

Sara cut off 1/8 of a 48-inch piece of ribbon. Jane cut off 1/9 of a 36-inch piece of ribbon. They compared their cut pieces. Whose piece is longer? How much lo
What is 14/10 as a decimal?
Solve the system of equations using substitution. y= 3/4x-7 4x- 6y=50
Why did antidemocratic governments rise to power in postwar Europe and Asia?
Simplify expression: 3^{−(4a+1)} −3^{−(4a−1)} + 3^{−4a}
7b ÷ 12 = 4.2                  What is b?
explain the shift of power from kings to nobles during the middle ages
name the 4 main elements that make up 95% of an organism
Simplify each side of the following equation before applying the addition propertyx − 9 + 6 = −5 − 4
A cat is being chased by a dog. Both are running in a straight line at constant speeds. The cat has a head start of 3.8 m. The dog is running with a speed of 8