Question: In programming, it is normal to have a variable or function name containing multiple words. Currently two styles of naming variables are the most dominant:

In programming, it is normal to have a variable or function name containing multiple words. Currently two styles of naming variables are the most dominant: Snake case and Camel case.
Snake case separates each word using underscores, and all the letters used can be either upper or lower cased. For example, snake_case or sNaKe_CaSe are written in Snake case.
Camel case combines the words. All the letters are lower cased, but capitalizing the first letter starting from the second word. For example, camelCase is written in Camel case.
One function that can be helpful is camelCaser, which transforms a Snake case name into a Camel case name. For example, transforming from snake_case into snakeCase.
Multiple students in the past have tried to implement the function camelCaser. Some of them got it right, but some of them got it wrong. Your job is to write a testing function that determines if a given implementation of camelCaser is correct or not. More specifically, your function should test camelCaser in the following ways:
Test the function on normal Snake case inputs, and check if the output matches Camel case requirements
Check the edge cases (What happens when there are no words? What happens when there are two consecutive underscores?)
Check if the function camelCaser throws any error at any point. There are some inputs that will cause exceptions. A correct implementation should never return any error
You do not need to check for cases where the input is not a string
Define a function tester that takes one argument: the function you need to test. Your tester should return True if the input function satisfies the requirements, and False otherwise. You will be graded with several correct or incorrect implementations.
Your code snippet should define the following function:
NameTypeDescriptiontesterpython functionTest implementation of camelCaser
user_code.py

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!