Conditional Structure Exercises in Python Programming

The students of a course have been divided into two groups A and B according to sex and name. Group A consists of women with a name before M and men with a name after N and group B for the rest. Write a program that asks the user their name and gender, and displays on the screen the group that corresponds to them.
Solution:
Code:
name = input("What's your name? ")
gender = input("What is your sex (M or H)? ")
if gender == "M":
if name.lower() < "m":
group = "A"
else:
group = "B"
else:
if name.lower() > "n":
group = "A"
else:
group = "B"
print("Your group is" + group)
#Python Programming Importance
Hope You will learn Something. Happy Coding