Question: part b please in python [10] 4. (a) Write a Python or MATLAB function that when given a number between 0 and 9 outputs a

part b please in python

part b please in python [10] 4. (a) Write a Python or

[10] 4. (a) Write a Python or MATLAB function that when given a number between 0 and 9 outputs a character string for the word representation of that number. For example, an input of 1 should return the character string 'one', an input of 2 should return two' etc. Your function should check whether the number inputted is an integer between 0 and 9 and print a suitable error message if not. (b) Write a Python or MATLAB program that defines an integer variable x which is equal to your ID number and prints a string of words representing each digit of that number. For example, if your student ID number is 21012345 then your program should output [15] two, one, zero, one, two, three, four, five, Hint: you might find the following commands for converting between numbers and strings useful for answering part (b): Function Python MATLAB convert a number to a string str(x) string(x) convert a string to an integer int(string) str2num(string)

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 Databases Questions!