Brief Overview of Python
Class 11 · Informatics Practices
4 ideas in Class 11 Informatics Practices, explained in plain words, with games and quizzes to practise.
Running Python
Part of: Python Start
Python executes line by line; print displays; comments explain; interactive and script modes both work.
Why it matters. First programs run. Modes known.
Key words
- Interpreted
- : Running a program line by line at once.
- print()
- : Showing output text on the screen.
- Comments
- : Hash-mark notes explaining the code.
- Interactive mode
- : Trying single lines on the spot.
- Script mode
- : Saved lines run together as a file.
- Keywords
- : Words reserved for special Python meaning.
Try it in two minutes
- Open console.
- Print hello.
- Save script.
Try at home. Print your name.
Data and Names
Part of: Python Start
Variables name storage; int, float, string hold values; naming rules bar digits first, spaces.
Why it matters. Data stored typed. Names valid.
Formulas
- Names cannot start with a digit or contain spaces
- Type is set by the value, not by a declaration
Key words
- Variable
- : Named storage holding a value in memory.
- Integer
- : Whole numbers without fractions.
- Float
- : Numbers with decimal points.
- String
- : Text held inside quotes.
- Dynamic typing
- : Type fixed by the stored value itself.
Try it in two minutes
- Name validly.
- Assign values.
- Check types.
Try at home. Name five variables.
Operators Work
Part of: Expressions and Input
Floor, divide, power, modulo vary; brackets order work; precedence rules apply.
Why it matters. Values computed. Order respected.
Formulas
- 9 // 2 = 4, dropping the fraction part
- 9 / 2 = 4.5, keeping the fraction
- 20 % 6 = 2, the remainder after division
- Brackets first, then power, then multiply and divide
Key words
- Floor division
- : Division dropping the fraction part.
- True division
- : Division keeping the decimal result.
- Modulo
- : Remainder left after whole division.
- Power operator
- : Repeated-multiplication operator of numbers.
- Precedence
- : Rule fixing which operator acts first.
- Boolean result
- : True or False result of a comparison.
Try it in two minutes
- Spot operators.
- Apply precedence.
- Compute result.
Try at home. Evaluate five sums.
Input and Casting
Part of: Expressions and Input
Input reads text; int, float, str convert; print shows; joining needs same types.
Why it matters. Users feed data. Types converted.
Formulas
- input() always returns text, even for numbers
- Joining words needs numbers changed to text first
Key words
- input()
- : Reading a line typed by the user.
- Casting
- : Explicitly changing a value from one type to another.
- int()
- : Whole-number form dropping any fraction.
- float()
- : Decimal form of a whole number.
- str()
- : Text form used for display and joining.
- Text trap
- : Texts joining instead of adding as numbers.
Try it in two minutes
- Read input.
- Convert type.
- Print result.
Try at home. Input your age.
What your child will practise
- Data and Names: Jungle Puzzle (Clue Puzzle)
- Data and Names: Jungle Quick Fire (Quick Fire)
- Input and Casting: Candy Puzzle (Clue Puzzle)
- Operators Work: Space Quest (Flip and Match)
- Running Python: Space Quick Fire (Quick Fire)
- Quiz: Data and Names (8 questions)
- Quiz: Input and Casting (8 questions)
- Quiz: Operators Work (8 questions)
- Quiz: Running Python (8 questions)