Getting startedFunctionsVariablesVariables 2InputsSelectionFlowchartsData typesPseudocode1Pseudocode2Subprogram1Subprogram2 |
What is a Variable?You are playing a football game and every time you score, the game still displays that your score is zero. That would be annoying! If only the game had a way of changing every time you score and remembering the number for the whole length of the game. Programmers do this by using a data structure called a "variable".
TeamOneScore = 0 TeamTwoScore = 0 At the start of a football game the value stored in a variable for each team will be zero, but when a team scores, the value will increment by one, like: TeamOneScore = 1 TeamTwoScore = 0 Test you knowledge
Loading KS3 – Python – Variables1
|