- 1

Length of Word

How can I give length of word and save it in int ?

6th Sep 2022, 2:58 PM
نوید فنونی
نوید فنونی - avatar
7 ответов
+ 4
By using the len() function. What have you tried so far?
6th Sep 2022, 2:59 PM
Lisa
Lisa - avatar
+ 1
your code lacks the ***INDENTATION*** of the function's code block What exactly is it supposed to do? If it is a task from a sololearn course, mention course name and task number.
8th Sep 2022, 7:05 PM
Lisa
Lisa - avatar
0
Why does this code have an error ? def search(x, y) : z = len(x) t = len(y)
7th Sep 2022, 3:52 PM
نوید فنونی
نوید فنونی - avatar
0
you did not indent the code proberly and you never call the function or rint z or t. Is this the complete code?
7th Sep 2022, 4:01 PM
Lisa
Lisa - avatar
0
My code is this But the error is in line 2 and 3 def search(x, y) : z = len(x) t = len(y) caunterx = 0 cauntery = 0 for i in range (0,z): if x[caunterx] == y[cauntery] : caunterx = caunterx + 1 cauntery = cauntery + 1 if cauntery == t return("Word found") break else : continue i = i + 1 else : cauntery = 0 caunterx = caunterx + 1 if caunterx == z : return("Word not found") break else : continue i = i + 1 text = input() word = input() print(search(text, word))
8th Sep 2022, 6:53 PM
نوید فنونی
نوید فنونی - avatar
0
This is “Search Engine” project and need help to do it
9th Sep 2022, 1:16 PM
نوید فنونی
نوید فنونی - avatar
0
Read the previous lesson again and use the "in" operator to test ***if x in y*** (hint!) Also check the ***indentation*** of your code
9th Sep 2022, 1:35 PM
Lisa
Lisa - avatar