SORU
21 Mart 2010, Pazar


'eşdeğer && bir deyim s Python

İşte benim kod:

# F. front_back
# Consider dividing a string into two halves.
# If the length is even, the front and back halves are the same length.
# If the length is odd, we'll say that the extra char goes in the front half.
# e.g. 'abcde', the front half is 'abc', the back half 'de'.
# Given 2 strings, a and b, return a string of the form
#  a-front   b-front   a-back   b-back
def front_back(a, b):
  #    your code here   
  if len(a) % 2 == 0 && len(b) % 2 == 0:
    return a[:(len(a)/2)]   b[:(len(b)/2)]   a[(len(a)/2):]   b[(len(b)/2):] 
  else:
    #todo! Not yet done. :P
  return

Koşullu EĞER bir hata alıyorum. Neyi yanlış yapıyorum?

CEVAP
21 Mart 2010, Pazar


and && yerine isterim.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Learn word 2013 tutorials

    Learn word 2

    5 AĞUSTOS 2014
  • Michael Zhang

    Michael Zhan

    8 EYLÜL 2012
  • Moto Journal

    Moto Journal

    28 Mayıs 2007