GR 7 Handout-Variables, Constant, Datatypes
GR 7 Handout-Variables, Constant, Datatypes
•9studname
•stud_details
•car model
•%student
•employee@name
•PI
•GRAVITY
Data Types
Data Type is nothing but a categorization of data of different types. A data type
defines set of values along with operations that can be performed on those
values.
The following table shows data types with examples:
Basic programming
Worksheet 2
The pseudocode for an
assignment statement
A value is assigned to an item/variable using the ¨ operator.
The variable on the left of the ¨ is assigned the value of the
expression on the right. The expression on the right can be a
single value or several values combined with any of the
following mathematical operators.
Mathematical Operators in pseudocode
Comparison operators in Pseudocode
Operators in Python
Arithmetic Operators: there are 7 arithmetic operator supported in python.
!= Not Equal Return True if two operands are not equal. >>>print(a!=b) True
> Greater than Return True if ‘a’ is more than ‘b’ where ‘a’ is >>>print(a>b) False
left and ‘b’ is right operand.
< Less than Return True if ‘a’ is less than ‘b’ where ‘a’ is left >>>print(a<b) True
and ‘b’ is right operands.
>= Greater than or Return True if ‘a’ is more than or equal to ‘b’ >>>print(a>=b) False
equal to where ‘a’ is left and ‘b’ is right operands.
<= Less than or Return True if ‘a’ is less than or equal to ‘b’ >>>print(a<=b) True
equal to where ‘a’ is left and ‘b’ is right operands.