Chapter 11 Programming Concepts

There are many different programming languages, such as high and low level languages. High level languages are like Python and Java, but we will mainly be focusing on Python. Low level languages are programs like Scratch.  Python is a open source programming language that has easy and readable codes. A variable is a named data that can change over time in the execution of the program. A constant is a data store that does not change in the execution of the program.

An integer in python,  is a positive or negative number which is a whole number. Real number is a positive or negative with a fractional part.  A Char is a variable or  constant in a single character. A  String is several characters in length, a string can also have no characters, it depends on what you are doing. A Boolean variable is only things like True and False or 0 and 1.

There are 2 kinds of loops, for and while loops, For loops keep going and while loop keeps going until a condition is met. The if, elif and else functions do this and you use them for different things, like if is the loop which keeps going until a condition is met. And elif is if the condition is not met this function goes into play. Else is when all the condition is gone this takes over. While:Keeps going until a condition is met, (endless). For:It is set number of times in the beginning.

Validation is to check if the user has inserted the right information and to make them answer the question correctly to proceed on. You can validate by using for and while loops so that they have the question always popping up and will keep until they type in the correct answer.

This is short video on my python script on the survey i did.  Hopefully this helps you

 

 

Keywords:

  • Algorithm: math instructions, and calculations.
  • Sequence: instruction which are in order, to make the program to work.
  • Selection: Used by the IF statement, it allows you to follow a different path n programs.
  • Repetition: Getting instructions to be repeated a set of number of times (for loop) and endless loop (while loop)
  • Totaling: A score that needs variable (an integer) and add it up each time the user gets the correct answer, or something like that. Starts with 0 and each time the user does something, the variable will change, it can increase  by 1 or any integer.
  • Counting: Counting is used with repetition with the counter only increasing by 1, every time the user gets a correct answer  its increased by 1

 

2016-09-13.png.

This is the code for the tickets, and the test table.

 

Normal Abnormal Extreme
4 27

-1

A

1

25

 

 

here’s my 2nd video i worked on. Enjoy!

 

 

 

 

Advertisements