[Tutor] change the position and updated

Sarika Shrivastava sarika1989.08 at gmail.com
Wed Apr 26 08:44:54 EDT 2017


Thanks you  Neeraj giving the solution of problem I was trying  as but not
able to find right solution

Thanks to others also for giving a nice advice

On Wed, Apr 26, 2017 at 4:36 AM, Neeraj Sharma <neeraj.sh7 at gmail.com> wrote:

> c = [(12, 45), (1234, 567), (12345, 0), (678, 123456)]
>
> max_length = 0
> for key,value in c:
>      list1 = []
>      list2 = []
>      for i in str(key):
>              list1.append(i)
>      for j in str(value):
>              list2.append(j)
>      if (len(list1)>len(list2)): max_length = len(list1)
>      else: max_length = len(list2)
>      result=""
>      for i in range(0,max_length):
>          try: result = result + list1[i]
>          except: pass
>          try: result = result + list2[i]
>          except: pass
>      print int(result)
>
> On Wed, Apr 26, 2017 at 3:01 PM, Neeraj Sharma <neeraj.sh7 at gmail.com>
> wrote:
>
>> Hi,
>>
>> Find the code below
>>
>> c = [(12, 45), (1234, 567), (12345, 0), (678, 123456)]
>>
>> max_length = 0
>> for key,value in c:
>>      list1 = []
>>      list2 = []
>>      for i in str(key):
>>              list1.append(i)
>>      for j in str(value):
>>              list2.append(j)
>>      if (len(list1)>len(list2)): max_length = len(list1)
>>      else: max_length = len(list2)
>>      for i in range(0,max_length):
>>              pass
>>      result=""
>>      for i in range(0,max_length):
>>          try: result = result + list1[i]
>>          except: pass
>>          try: result = result + list2[i]
>>          except: pass
>>      print int(result)
>>
>> On Wed, Apr 26, 2017 at 12:13 PM, Sarika Shrivastava <
>> sarika1989.08 at gmail.com> wrote:
>>
>> > Input :
>> > c=[(12,45),(1234,567),(12345,0),(678,123456)]
>> >
>> > #o/p==1425
>> > #o/p==1526374
>> > #0/p==102345
>> > #o/p===617283456
>> >
>> > Question explanation:
>> >
>> > in list c we have some tuples so I need to take tuple value one by one
>> and
>> > change the position of value like wise
>> >
>> >  first tuple value (12 ,45) then  then 1 we pick up append on 4 So it
>> make
>> >  14 after tat 2 we pick and append on 5 so 25 then final o/p is 1425 ,
>> >
>> > Please check output also...
>> >
>> > --
>> > Best regards,
>> >
>> > Sarika Shrivastava
>> > Associate Engineer
>> >
>> > Continental Automotive Components (India) Pvt. Ltd.,
>> > 8th Floor, Gold Hill Supreme Software Park,
>> > Plot No. 21, 22, 27 & 28, Shanthipura Road,
>> > Electronics City, Phase II, Hosur Road,
>> > Bangalore-560 100
>> >
>> > Tel: +919741457409 <+91%2097414%2057409>
>> > Mobile: +919741457409 <+91%2097414%2057409>
>> > E-Mail: sarika.shrivastava at continental-corporation.com
>> > Web: www.continental-corporation.com
>> > _______________________________________________
>> > Tutor maillist  -  Tutor at python.org
>> > To unsubscribe or change subscription options:
>> > https://mail.python.org/mailman/listinfo/tutor
>> >
>>
>>
>>
>> --
>>
>> *Thanks & Regards*
>>
>> *Neeraj Sharma+91-9873741375 <+91%2098737%2041375>*
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> https://mail.python.org/mailman/listinfo/tutor
>>
>
>
>
> --
>
> *Thanks & Regards*
>
> *Neeraj Sharma+91-9873741375 <+91%2098737%2041375>*
>



-- 
Best regards,

Sarika Shrivastava
Associate Engineer

Continental Automotive Components (India) Pvt. Ltd.,
8th Floor, Gold Hill Supreme Software Park,
Plot No. 21, 22, 27 & 28, Shanthipura Road,
Electronics City, Phase II, Hosur Road,
Bangalore-560 100

Tel: +919741457409
Mobile: +919741457409
E-Mail: sarika.shrivastava at continental-corporation.com
Web: www.continental-corporation.com


More information about the Tutor mailing list