# Naming conventions problem # Function to return the case for an identifier def IName(Part1, Part2, Convention): if Convention == "kebab-case": # First part of the identifier in lowercase First = Part1.lower() # With a dash Second = "-" # Second part of the identifier in lowercase Third = Part2.lower() return First + Second + Third elif Convention == "snake_case": # First part of the identifier in lowercase First = Part1.lower() # With an underscore Second = "_" # Second part of the identifier in lowercase Third = Part2.lower() return First + Second + Third elif Convention == "camelCase": # First part of the identifier in lowercase First = Part1.lower() # First character of second part in uppercase Second = Part2[0].upper() # Rest of the second part in lowercase ThirdStop = len(Part2)-1 Third = Part2[-ThirdStop:].lower() return First + Second + Third elif Convention == "PascalCase": # First character of the identifier in uppercase First = Part1[0].upper() # Rest of the first part in lowercase SecondStop = len(Part1)-1 Second = Part1[-SecondStop:].lower() # First letter of second part in uppercase Third = Part2[0].upper() # Rest of the second part in lowercase FourthStop = len(Part2)-1 Fourth = Part2[-FourthStop:].lower() return First + Second + Third + Fourth # Main program print("kebab-case:", IName("Shields", "Up", "kebab-case")) print("snake_case:", IName("Shields", "Up", "snake_case")) print("camelCase:", IName("Shields", "Up", "camelCase")) print("PascalCase:", IName("Shields", "Up", "PascalCase"))