Posts
 
Reputation
Joined
Last Seen
Ranked #2K
Strength to Increase Rep
+0
Strength to Decrease Rep
-0
100% Quality Score
Upvotes Received
2
Posts with Upvotes
1
Upvoting Members
2
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
1 Commented Post
0 Endorsements
~19.9K People Reached
Favorite Forums
Favorite Tags

3 Posted Topics

Member Avatar for vegaseat

[QUOTE=bumsfeld;260289]If you have simple English word like: [CODE]str1 = 'supercalifragilisticexpialidocious'[/CODE] How would you form string that has every second letter in capital (upper case).[/QUOTE] I do not know if it is appropriate to post a solution here. But I would like to have feedback to see if my solution can …

Member Avatar for vegaseat
20
18K
Member Avatar for ywang

Here is another solution: [CODE]numbers = '123456789' i = 1 j = 0 for num in numbers: x = (int(numbers[0:i])) y = (int(numbers[j])) tot = (int(numbers[0:i])*8+(int(numbers[j]))) i += 1 j += 1 print("%d*8+%d=%d" % (x, y, tot))[/CODE] 1*8+1=9 12*8+2=98 123*8+3=987 1234*8+4=9876 12345*8+5=98765 123456*8+6=987654 1234567*8+7=9876543 12345678*8+8=98765432 123456789*8+9=987654321

Member Avatar for vegaseat
0
1K
Member Avatar for nightrev

Here is another solution using only "strings, lists, and appropriate operators/methods". [CODE]def convert_mnth(date_string): months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"] month = months[int(date_string[-10:-8])-1] day = date_string[-8:-5] year = date_string[-5:] print("%s%s%s" %(month,day,year))[/CODE] _____________________________________________________ >>>convert_mnth('12/23/2010') Dec/23/2010 >>> convert_mnth('1/23/2010') Jan/23/2010

Member Avatar for Legnoduro
0
128

The End.