Term 2 Chapter 3 Flashcards
1
Q
What are the 2 main datatypes?
A
Numbers and Sequence
2
Q
What are the four data types in numbers?
A
Integer: Any positive or negative whole number
Float: Positive or negative Decimals
Complex: Expressed in the from of a+bj
Boolean: True or false
3
Q
What are the three datatypes in sequence?
A
String, Tuple and List
4
Q
Name different operators with ther sign.
A
Addition + Subtraction - Multiplication * Division / Modulo % Exponent ** Floor Division //
5
Q
What are the four built-in list functions with their definitions?
A
- len():It shows the number of elements in the list.
- Max(): It shows the elements with the maximum value in the list.
- Min(): It shows the element with the minimum value in the list.
- Sum(): It adds all the elements in the list
6
Q
Give example of string, tuple and list
A
- String: ‘emon’ “emon”
- Tuple: (“Ankita, 27, 12.5, “Christian”)
- List: [10, 20, 30, 40]
7
Q
Differentiate between tuple and list
A
Tuple: values cannot be changed (immutable)
Tuple: Round Brackets
List: Values can be changed (mutable)
List: Square Brackets
8
Q
What are the different types of operators in Python?
A
- Arithmetic Operations
- Logical Operators
- Membership Operators
- Relational or compassion Operators
- Assignment operator
- Identify Operator