150k views
1 vote
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.)

User Mugsy
by
7.8k points

1 Answer

1 vote

Answer:

The code is attached.

Step-by-step 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

Define a Python function called leng_of_str to calculate the length of a string (Hint-example-1
User Antoine Gamond
by
7.7k points