Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (1.6k points)

Here's my code:

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):] 


    #todo! Not yet done. :P


I'm getting an error in the IF conditional. What am I doing wrong?

2 Answers

0 votes
by (25.1k points)

You can simply use the keyword' and in place of && operator.

0 votes
by (106k points)
edited by

While in Python for logical and we use ‘and’ keyword and for logical or we use ‘or’ keyword.


if foo == 'abc' and bar == 'bac' or zoo == '123':

To know more about this you can have a look at the following video tutorial:-

Interested to learn more about Python? Come & join our Python online course

Related questions

0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
asked Sep 25, 2019 in Python by Sammy (47.6k points)

Browse Categories