Answer to Question #318503 in Python for Surya

Question #318503

A teacher in a class with N students has noticed that some students have formed their own groups and hence prevented intermingling of students to get those students to mix with each other, the teacher has decided a seating pattern.The seating pattern is very simplistic viz. every boy should sit next to a girl and every girl should next to a boy. They are all seated in one line. It is also mandatory that no two boys sit together, and no two girls sit together. Your task is to make the above happen with minimum number of swaps between as-is situation to desired solution


1
Expert's answer
2022-03-26T12:41:31-0400
def arr_stud(N):
    n_b = int(input('no of boys: '))
    n_g = int(input('no of girls: '))
    if n_b == n_g:
        return 2
    else:
        return 0

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS