Skip to content

ExeterBScDTS/ECM2429-workshop-1-exercises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECM2429-workshop-1-exercises

Python programming exercises

Aims

Understand how to create Python classes and explore when to use them.

Understand the @property decorator.

Use PyTest framework to test objects.

Explore the design and testing of GUIs.

Getting started

Copy this repository to a suitable working directory - it's often easier to work on your C: drive.

Install PyTest using Pip. You might want to create a Python virtual env first.

pip install pytest

Testing properties.py

  1. Run the tests provided using the pytest command.

  2. Replace print statements with logging calls.

  3. Consider the failing test. Can you fix the code.

  4. Try changing name from John to Johnny. What happens?

  5. Write a similar test for the age parameter, one that checks for negative values.

  6. What happens if you give a floating point age? e.g. 12.5

  7. How might the code be further improved?

GUI programming calculator.py

  1. Run the program. You might need to install TkInter

  2. Use the keys and observe the output.

  3. Can you create a working calculator?

  4. How can unit tests be used?

Sample code

The file speech/record.py should help with the assignment. It needs tidying up, and might not be complete.

About

Python programming exercises

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages