KristjanVeensalu / Omis_Python_EN

Omis Python course repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Omis Python

Python and programming basics course.

Homepage

Lecturer: Kristjan Veensalu

Email: kristjan.veensalu@gmail.com


Useful Links:
Homework

  • Create a calculation excercise program with 10 different calculations
  • 1. All of the calculation text must be from a text file.
  • 2. The program must still check if the calculation is correct.
  • Make a repository for your project.

  • Pilt pythoni koodist

    Fixing bugs:

    The first goal in terms of debugging should be to start the program on the first attempt, ie the program code has been reviewed, primary minor errors and slipups have been removed (syntax errors). To do this, read the program and make sure that:

    • None of the variables have a keyword name
    • at the end of the function (if, while, for, def) there is a colon:
    • indentation is consistent. It is recommended to use only spaces or only tabs. Indents should be the same size.
    • all strings have a start and end symbol (the latter tends to be omitted)
    • all brackets are even
    • the comparison is made with == and not = = and the assignment is with = and not ==

      If the listed errors have already been found before starting the program, the check could be extended. The following is a selection of questions that the tester is advised to ask while reading the program code (by the way, this activity is officially called static testing):

    1. Review the variables and their names:
    • Whether an attempt is made to use the value of a variable before the variable occurs, ie is there any undervalued variable on the right side of the attribution statement, expression, printout?
    • Have you made a mistake while typing a variable name? Or have you written a variable in one place in the program with a capital letter but with a lowercase letter for the same variable elsewhere?
    1. Check the non function words:
    • They must be in a different color in the IDLE editor - then they are spelled correctly. If not, check the word for an error.
    • Also look at what features you use - maybe it's some of the features you are using to turn to a separate module (import math) etc.?
    1. Statements and data types - review both arithmetic and logical statements:
    • Are there suitable data types in one sentence or expression? Using numbers and strings together doesn't usually end well. The computer can not calculate "carrot" + 3.
    • Have all variables used in the calculation been converted to numbers after entry?
    • Are integers (int ()) or float () appropriate to the nature of the data?
    • Has the order of actions been set correctly and are there enough brackets used?
    • Could it be a divison by zero error?
    1. Comparisons - Review the comparison operations in the logical statements:
    • Are different things compared: for example, text and number? The computer can't decide if "carrots"> 3
    • Is the algorithm correctly translated into comparison operations? For example, the result of using the characters < or <= may be different.
    • Are the priorities for comparison work set correctly?
    • Is the decimal variable compared to a specific number and then to the equal sign (==)? Floating point numbers may not be accurate and are therefore unsuitable for comparison with an equal sign.
    1. Errors in the program structure - review all language constructions (cycles, options)
    • Do the indents correctly define the boundaries of the planned cycle and selection sentences?
    • Whether the loops are essentially planned correctly - whether the content and logic of the while loop is consistent and the value of the expression can become False? Are the variables used in the logic statement values ​​changed within the cycle?
    • Can the logic statement at the beginning of the cycle on the first iteration be True? Does the cycle start at all?

    Good luck reading your code and finding errors on your own!


    Student Githubs:
    1. Anna Jakovleva

About

Omis Python course repository


Languages

Language:Python 100.0%