Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This project make in python in this project you are NOT aloud use this thing that its lists, tuples and dictionaries are NOT allowed in

This project make in python in this project you are NOT aloud use this thing that its lists, tuples and dictionaries are NOT allowed in your code. Knowing mathematics is a necessary skill for any engineer or computer scientist. To help us practice our math skills, we will write a program that checks our equations. The program should read from the user equations of the form: a b = c where a,b and c are integers and is one of +,-,x,// and %. Notice that we're only using integers, so all the actions are just integer based calculations. Also note that we're using x instead of *, just because it looks nicer. The program should check if the equation is correct. If it is correct, it should print out "Correct" but if the equation is wrong, it should print out "Sorry, " followed by the correct version of the equation. If the user writes an action that is not one of the five allowed actions, the program should print out "Sorry, I don't understand this equation". The program should continue to ask for equations until the user writes "quit". Then the program should print out how many equations we tried, how many were correct and how many of them were wrong. To get top score for this project, your code needs to fulfil the following criteria: - The code should have as little repetition as possible. Any text that the user sees should be written only once in the code, i.e. if we want to change "Correct" to something else, we should only have to change a single line of code. - The main part should be short and concise, but still descriptive. A reader should be able to tell exactly what your program does by only looking at the main part, but the main part should have less than 20 lines of code (not counting empty lines). The only way to achieve this is to use functions (and even functions that return more than one value). - Functions should be clear and well designed. Each function should do a single (or a few very related) things. You should be able to explain in a single short sentence what each function does. Each function should have a doc-string with this explanation.

Its have this output in program : Equation: 45 + 23 = 732 Sorry, 45 + 23 = 68 Equation: 4 x 3 = 12 Correct Equation: 7 // 3 = 2 Correct Equation: 7 % 3 = 1 Correct Equation: 4 + 2 = 432 Sorry, 4 + 2 = 6 Equation: quit You tried 5 equations. You got 3 correct and 2 wrong. Equation: 2 + 4 = 6 Correct Equation: 2 - 4 = 24 Sorry, 2 - 4 = -2 Equation: 7 $ 23 = 32 Sorry, I don't understand this equation Equation: 4 % 3 = 2 Sorry, 4 % 3 = 1 Equation: 6 x 6 = 36 Correct Equation: 9 ? 32 = 2372 Sorry, I don't understand this equation Equation: quit You tried 4 equations. You got 2 correct and 2 wrong. Equation: 1 + 1 = 1 Sorry, 1 + 1 = 2 Equation: 1 x 2 = 1 Sorry, 1 x 2 = 2 Equation: 1 * 4 = 23 Sorry, I don't understand this equation Equation: quit You tried 2 equations. You got 0 correct and 2 wrong.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Distributed Relational Database Architecture Connectivity Guide

Authors: Teresa Hopper

4th Edition

0133983064, 978-0133983067

More Books

Students also viewed these Databases questions