Question: Notice that the ASK command prompts the user for input using the name from the ASK command. The assignment page on Canvas will have a
Notice that the ASK command prompts the user for input using the name from the ASK command.The assignment page on Canvas will have a bunch of example scripts. Part of your work is to understandthe Tho language so well that you can read the scripts and understand what they doTaskWrite a program that: Asks the user for the name of a script to interpret. Opens the named script its a text file with commands in it reading the contents. Executes the script line by line.Hints: A Python file has been given to you containing the function isfloat which you can import. It takesa string as input, and returns True if the string can be converted to a floating point value, and Falseif not. The function itself uses exceptions, which you dont need to understand today; its a topic wecover in second year. You will need to read a file using File IO You will have to look at each line, to see what the commandis and depending on the command, you may need to look at an argument. For the ASK command, use a dictionary to remember the names and values. The keys in your dictionary will keys are the names, and the values are the floating point values that the user typed in TheASK command affects this dictionary, but not the register. The arithmetic commands modify the value in the register R Your main task is to correctly interpret correct Tho scripts. However, just as it is possible to write Pythonscripts that have syntax errors or logic errors, it is quite possible to write Tho scripts with syntax errorsand logic errors. For this assignment, you are not required to deal with errors in the Tho scripts. If yourprogram crashes because of an error in a Tho script eg DIV thats perfectly acceptable for thisquestion If your program crashes because of an error in your Python program, thats something you
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
