The string of the string
Write a function to receive a string (String) and return the number of letters
Note: To solve this question, you should not use ready -made functions
Example:
get_len('code-bezan.ir') # 13
Write a function to receive a string (String) and return the number of letters
Note: To solve this question, you should not use ready -made functions
Example:
get_len('code-bezan.ir') # 13
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
def counter(string): print('tool reshte barabr ast ba:\n',len(list(string))) counter(string = input('yek reshte vared kon:\n'))
def n(input_string): count = 0 for character in input_string: count += 1 return count string =input("name:") print(n(string))
# In the following function does not calculate the distance as letters and if we want to calculate we must erase the condition def get_len(par): lenght = 0 for i in par: if i == ' ': pass else: lenght += 1 return lenght a = 'this is a test' print(get_len(a))
def get_len(s):
count = 0
for char in s:
count += 1
return count
# Example
print(get_len('code-bezan.ir')) # 13
def toolstr(n): x = len(n) return f"tooll reshete string: {x}" print((toolstr(n=str(input("enter your tool string:")))))
a = input('a: ')
print(len(a))
i=(input("str:")) j=len(i) print(j)
Submitting answers is currently unavailable.
You must be logged in to access this section.
Login/Sign up If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.