I have a list which needs to be alphabetized(ignoring lower and uppercase) and printed with spaces and “+” seperating each element in the list. Here’s my code:
#!/usr/bin/python3.2
fruit = ['A', 'banana', 'Watermelon', 'mango'] #list containing fruits name
for diet in sorted(fruit):
print(diet)
This prints the each fruits in a single line. I want my result to be like this:
A + banana + mango + Watermelon
How do I achieve this result? Thanks!
for more detials visit :
http://docs.python.org/library/stdtypes.html#str.join
http://wiki.python.org/moin/HowTo/Sorting/