Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# Project Description The following table describes numbers from 0 - 10 in three languages: | Number | English | French | Pinyin (Chinese) |

# Project Description

The following table describes numbers from 0 - 10 in three languages:

| Number | English | French | Pinyin (Chinese) | |--------|---------|--------|------------------| | 0 | zero | zero | ling | | 1 | one | un | yi | | 2 | two | deux | er | | 3 | three | trois | san | | 4 | four | quatre | si | | 5 | five | cinq | wu | | 6 | six | six | liu | | 7 | seven | sept | qi | | 8 | eight | huit | ba | | 9 | nine | neuf | jiu | | 10 | ten | dix | shi |

_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_XXX() 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.

make sure to run the code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions