File tree 1 file changed +50
-0
lines changed
1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ """Rani and Raji are sisters they love to compete by playing math games which gradually helped them in their academics one day.
2
+ rani gave her a task to her sister.
3
+ The task involves a string e program takes a string and calculates the length of the string without using library functions.
4
+ Mandatory: must use the function name as "def find(self):" and should use object name as "L" and should also use "L.find()"
5
+ But raji thought she can code a program for this concept but she is finding it difficult.
6
+ Can you help her with the suitable logic?
7
+ Constraints:
8
+ 1 < string length < 1000
9
+ INPUT:
10
+ the first line contains the string.
11
+ OUTPUT:
12
+ print the result as output.
13
+
14
+ Logical Test Cases
15
+ Test Case 1
16
+ INPUT (STDIN)
17
+ orange
18
+ EXPECTED OUTPUT
19
+ Length of the string is:
20
+ 6
21
+ Test Case 2
22
+ INPUT (STDIN)
23
+ apple
24
+ EXPECTED OUTPUT
25
+ Length of the string is:
26
+ 5
27
+
28
+ use the keywords
29
+ KEYWORD
30
+ class length:
31
+
32
+ KEYWORD
33
+ def find(self):
34
+
35
+ KEYWORD
36
+ L.find()"""
37
+ class length :
38
+ def __init__ (self , string ):
39
+ self .string = string
40
+
41
+ def find (self ):
42
+ count = 0
43
+ for char in self .string :
44
+ count += 1
45
+ print ("Length of the string is:" )
46
+ print (count )
47
+
48
+ string = input ()
49
+ L = length (string )
50
+ L .find ()
You can’t perform that action at this time.
0 commit comments