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

  • Bucky Roberts

    Bucky Robert

    9 HAZİRAN 2011
  • DorkmanScott

    DorkmanScott

    14 NİSAN 2006
  • Lamarr Wilson

    Lamarr Wilso

    27 Aralık 2008