Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
1
Posts with Upvotes
1
Upvoting Members
1
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
0 Endorsements
~699 People Reached
Favorite Forums
Favorite Tags
Member Avatar for abcdr

I need to write a loop that traverses the list and prints the length of [B]each element[/B]. So far I have this: [code] def countEachElement(): elements= ["spam!",'1',['Brie','Roquefort','Pol le Veq'],['1','2','3']] i=0 while i < len(elements): print len(elements[i]) i=i+1 [/code] But it's not counting each element of the lists inside the list. …

Member Avatar for jcao219
0
95
Member Avatar for abcdr

I need to write a function that takes a string as an argument and outputs the letters backward, one per line.so far I have this: [code] def wordReverse(word): acum = "" for ch in word: acum = ch + acum return acum [/code] I tried adding \n to acum but …

Member Avatar for TrustyTony
0
159
Member Avatar for abcdr

I am trying to square each number in the list under [I]nums[/I]. But I don't know how to do it. I got this so far: [code] def squareEach(nums): for i in nums: y=i*i return y [/code] What is happening here is it's counting how many numbers are in the list …

Member Avatar for TrustyTony
0
445