+ 5

[ASSIGNMENT] ***** CHALLENGE #2 *****

String and length Task: Write a program to print a string and it's length in a single line of code without using length() function

18th Mar 2018, 2:56 AM
‎ ‏‏‎Anonymous Guy
19 Answers
20th Mar 2018, 2:52 PM
LukArToDo
LukArToDo - avatar
20th Mar 2018, 3:03 PM
LukArToDo
LukArToDo - avatar
+ 13
use .length , in place of .length() //after converting to array 😅
18th Mar 2018, 4:27 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
19th Mar 2018, 1:14 AM
AZTECCO
AZTECCO - avatar
+ 7
thanks..
21st Mar 2018, 4:24 PM
KäzÎ MrÎdÚl HøssäÎn
KäzÎ MrÎdÚl HøssäÎn - avatar
+ 6
My solution you can say onelinerÂż 100% free of length() functions. https://code.sololearn.com/cgPNuEso4TtS/?ref=app
18th Mar 2018, 5:53 AM
ƒred
ƒred - avatar
+ 5
Please utilize the lesson-factory when creating challenges. Thanks.
20th Mar 2018, 3:08 PM
Fox
Fox - avatar
+ 4
guys i was expecting for 1 liner but nice try and yes i did submit this as lesson
18th Mar 2018, 5:37 AM
‎ ‏‏‎Anonymous Guy
+ 4
C: unsigned len = sizeof(c_str)-1; Where c_str is a character array.
18th Mar 2018, 8:12 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 4
#python.. a=input();print(a,sum([a.count(i) for i in set(a)]))
21st Mar 2018, 3:38 PM
KäzÎ MrÎdÚl HøssäÎn
KäzÎ MrÎdÚl HøssäÎn - avatar
+ 3
I wasn't completely sure I'd be successful, but it looks like I was! But I'll let you be the judge. https://code.sololearn.com/cTtblsdRqEi5/#java Bonus: You can enter multiple strings and get their lengths, not just one string. Of course, challenges should be put in as lessons, now. https://www.sololearn.com/Discuss/1082512/suggestion-challenge-assignment-creation
18th Mar 2018, 3:42 AM
Sheldon Duncan
Sheldon Duncan - avatar
+ 3
Python strings have .__len__() magical method ;)
18th Mar 2018, 5:31 AM
ƒred
ƒred - avatar
+ 2
your code was really good @swim
20th Mar 2018, 9:28 AM
‎ ‏‏‎Anonymous Guy
+ 2
good job @käzÎ
21st Mar 2018, 3:59 PM
‎ ‏‏‎Anonymous Guy
+ 2
guys thanks for participating This is my try in c https://code.sololearn.com/cNto905PR1Tb/?ref=app
21st Mar 2018, 4:49 PM
‎ ‏‏‎Anonymous Guy
0
i did @cipherfox but they are not approved yet
21st Mar 2018, 2:35 AM
‎ ‏‏‎Anonymous Guy