Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The following table describes numbers from 010 in three languages: Part 1) Design 6 functions as follows: num_to_english() num_to_french() num_to_pinyin() pinyin_to_num() french_to_num() english_to_num() Functions with
The following table describes numbers from 010 in three languages: Part 1) Design 6 functions as follows: num_to_english() num_to_french() num_to_pinyin() pinyin_to_num() french_to_num() english_to_num() Functions with naming pattern: num_to_XXXX() should take a single parameter and based on the number argument return back the corresponding word in the given language. For e.g., num_to_english(5) should return back 'five' Similarly, functions with naming pattern: XXX_to_num() should take a single parameter and based on the str argument return back the corresponding number in the given language. For e.g., french_to_num('huit') should return back 8 . When a number or word is not recognized the function should return None (None is a valid Python return value). As an e.g., num_to_french(23) should return None and french_to_num('two') should return None. Part 2) Design a function called: french_to_pinyin(). This function should take a single parameter and based on the str argument (french word) it should return back the corresponding pinyin word. As examples: french_to_pinyin('neuf') should return back 'jiu' and french_to_pinyin('bonjour') should return None. Ideally, your design for french_to_pinyin() should internally just use french_to_num() and num_to_pinyin() As you work through this exercise, and write each function, write test code (in the main body) to make sure your functions are working properly
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started