Skip to content

meng-ucalgary/ensf-592-assignment-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ENSF-592 Assignment 2

📚 Learning Outcomes

  • Perform operations on dynamically-typed variables
  • Accept and analyze user input
  • Design control flow logic using data comparisons
  • Develop and implement user-defined functions
  • Print formatted output according to given specifications

💻 Program Specifications

Design a terminal-based calculator application. Your application must meet the following design specifications:

  • Prompt the user to enter a mathematical expression that includes three integer values and two operators. You may prompt for the input to be entered in any form or order you like, but be sure to give the user clear instructions.
  • Your program must correctly calculate and print the answer to the terminal.
  • The final calculation must show the original expression and the final answer. Follow the wording template shown in this example.
  • Example: If the user input was 1 - 2 * 5, then the output is: Your calculated result: 1 - 2 * 5 = -9
  • Your application must handle the order of operations correctly! i.e. * and / should be calculated before + and -
  • If any operator other than the basic four (+ - * /) is entered, give the user a feedback message such as Entered value is not a valid operator. and prompt for re-entry. Your program should not terminate.
  • You can assume that only valid integers will be given as numeric input. You do not need to test for their validity.
  • A screenshot with example terminal behaviour is included in the repository. This is for suggestion only, you do not need to follow this format exactly as long as all of the specifications are met.
  • Your code should include at least four user-defined functions, a mix of simple and compound data types, and at least two types of control flow statements (if/else, for, while, etc.).
  • Your code must follow the conventions discussed so far in the course (names_with_underscores, four spaces for indentations, spaces between variables/operators, comments throughout, etc.)
  • Your code will be run by the TAs as your end user.
  • FAQs about the assignment will be answered on the D2L discussion boards. Please check the boards for any clarifications before submitting.
  • The grading rubric will be posted to D2L.

📝 Assignment Tasks

  • Make sure to watch video lessons 1 - 7 and review the corresponding Jupyter Notebooks and lab sessions.
  • Clone this repository to your local computer.
  • Open VSCode and start a new terminal. Make sure that your ensf592 environment is activated.
  • calculator.py is provided as a starting point. Fill in the header with your own information.
  • Remember to test your program execution via the terminal: python calculator.py
  • Take a screenshot of your successful program run and upload it to your assignment repository.
  • Commit your screenshot and code.
  • Push your local git history to github: git push origin main
  • Submit your repository HTTPS link to the Assignment 2 D2L dropbox.
  • Tip: If you want to learn more about a specific aspect of a Python object, remember to take a look at the official documentation!

About

An assignment on simple command line calculator

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages