Starting my daily coding challenge series to stay consistent and sharpen problem-solving skills. Problem Statement: Given an integer `day` representing the day number of the week, print the corresponding day name. - The week starts from Monday (1) and ends on Sunday (7). - If the input is less than 1 or greater than 7, print "Invalid." - Ensure only the first letter is capitalized. Example: Input: `3` Output: `Wednesday` Input: `8` Output: `Invalid` Try solving it using: - Conditional statements Consistency beats motivation. See you in Day 2. #100DaysOfCode #CodingChallenge #JavaScript #Python #Java #CPP #ProblemSolving #Developers #SoftwareEngineer #LearnToCode #DSA
def get_day_name(day): days = [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ] if 1 <= day <= 7: return days[day - 1] else: return "Invalid" print(get_day_name(3)) # Wednesday print(get_day_name(8)) # Invalid