Ahmed is sending the final list of the names of the Computer Olympiad entrants to the results review committee so that the committee can print the final entry cards, but because there was no specific format for registering the names during the exam, the participants were nominated as standard. They did not write themselves. In addition, it is written in the continuation of each language name with which it has participated in the competitions, and at the beginning of each name, the gender of the people is specified. The standard form of nouns is such that the first letter of the noun is uppercase and the rest of the letters of the noun are lowercase. Write a program that reads the number, name, gender, and language of the entrants from the input, segregates the names based on gender, standardizes them, and writes in front of each name the language with which it competed. (In the output, first the gender of the woman and then the gender of the man should be printed. Names in each gender should be printed in the English alphabet.)
Sample input:
m.hosSein.python
f.miNa.C
m.aHMad.C++
f.Sara.java
Sample output:
f Mina C
f Sara java
m Ahmad C++
m Hossein python
How do I correct this code؟How to correct uppercase and lowercase letters؟
def Olampiad(n):
my_list = []
for i in range(0, n):
s = input()
s = s.lower()
my_list.append(s.strip().split('.'))
my_list = sorted(my_list)
return my_list
n = int(input(''))
for char in Olampiad(n):
if char[0] == 'f':
if char[2] == 'c' or char[2] == 'c++' or char[2] == 'c#' or char[2] == 'java':
print(char[0], char[1].capitalize(), char[2])
else:
print(char[0], char[1].capitalize(), char[2])
if char[0] == 'm':
if char[2] == 'c' or char[2] == 'c++' or char[2] == 'c#' or char[2] == 'java':
print(char[0], char[1].capitalize(), char[2])
else:
print(char[0], char[1].capitalize(), char[2])