Python Tasks - Pseudocode
What is pseudocode?
Pseudocode is a method of planning which enables the programmer to plan without worrying about syntax.
Pseudocode (sometimes written as pseudo-code) is a description of the source code of a computer program or an algorithm in a language easily understood by humans.
It uses the general structure of a computer programming language, but omits details that are required by machines to execute the code. The primary purpose of writing pseudocode is to enable humans to understand the computer program or algorithm without having to understand the programming language.
Python Keywords
- Keywords are the reserved words in Python.
- We cannot use a keyword as a variable name, function name or any other identifier. They are used to define the syntax and structure of the Python language.
- In Python, keywords are case sensitive.
- There are 33 keywords in Python 3.7. This number can vary slightly in the course of time.
- All the keywords except True, False and None are in lowercase and they must be written as it is. The list of all the keywords is given below.
How to write a Pseudo-code?
- Arrange the sequence of tasks and write the pseudocode accordingly.
- Start with the statement of a pseudo code which establishes the main goal or the aim.Example:
The way the if-else, for, while loops are indented in a program, indent the statements likewise, as it helps to comprehend the decision control and execution mechanism. They also improve the readability to a great extent.
Example:
if "1"
print response
"I am case 1"
if "2"
print response
"I am case 2"
No comments:
Post a Comment