The document outlines variable and constant declarations in Python and pseudocode, detailing data types such as Integer, Real, Boolean, Char, and String. It emphasizes the importance of declaring variables and constants, explaining that constants cannot be changed during program execution. Additionally, it provides examples of variable declarations and common functions for string manipulation.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
6 views2 pages
Assignment operator
The document outlines variable and constant declarations in Python and pseudocode, detailing data types such as Integer, Real, Boolean, Char, and String. It emphasizes the importance of declaring variables and constants, explaining that constants cannot be changed during program execution. Additionally, it provides examples of variable declarations and common functions for string manipulation.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Assignment operator
Python: =
Pseudocode:
Variables
Integer numberOfStudents Whole 2 bytes
numbers Real circleArea Numbers 4 bytes with a fractional part Boolean found True or False 1 bit or 1 byte in Higher Level Languages Char answer A single 1 Byte ASCII character String studentName Zero or more 1 byte per characters character
- Declaring a variable gets it ready for use in the program
- The data type is given to the variable
Examples:
DECLARE sidesInShape : INTEGER
DECLARE name : STRING
Name “Adithya”
Constants
CONSTANT Pi 3.1415926535
CONSTANT VAT 0.2
Words are separated by an underscore
- Declaring constants prevents the value from being changed
accidentally by a part of code - It shows a programmer that the value should stay the same throughout the program - A constant cannot be changed when the program is running. It can be changed before the program is compiled.
OUTPUT “How many hours a night do you sleep?”
^ is an exponent
(//)DIV is used for integer division, also known as quotient
(%)MOD returns the remainder after division
(**) Exponent in python
Function LENGTH (String) SUBSTRING(String, start, length) LCASE (Str) UCASE (Str)