Comp 1

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/31

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 2:41 PM on 3/31/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

32 Terms

1
New cards

Required as an input parameter

class Student():
	def __init__(self, name)

getting data in

2
New cards

Set at instantiation

class Student():
	def __init__(self, name)
	self.name = name

object has the data

3
New cards

Instance

An instance is a specific object created from a class or is part of a data type, with its own data and behaviour.

4
New cards

Instance Attribute

    def __init__(self, name, cid, year, tutor):
        super().__init__(str(name), int(cid))   #calling parent constructor
        self.year = year    #instance attribute
        self.tutor = tutor  #instance attribute
        self.ace_induction = False  #instance attribute

quality specific to that method relating to the class

An instance attribute is a variable defined in a class using self that stores data specific to each instance of the class.

5
New cards

Class Attribute

class DEStudent():
    '''class just for DesEng students'''
    Faculty = 'Engineering'

bf the def __init__(self) which is a method

A class attribute is a variable defined in a class that is shared by all instances (objects) of that class

6
New cards

Function

def greet(name):
	print("Hello", name)

Reusable block of code that performs a specific task

7
New cards

Method

class Student:
    def __init__(self, name):
        self.name = name

    def say_hello(self):   # ← this is a method
        print("Hi, I'm", self.name)

A method is a function defined inside a class that operates on instances of that class, typically using self.

8
New cards

Super()

class DEStudent(ImperialStudent):
	def__init__(self):
		super().__init__(name, cid)

where name and cid were defined in an earlier class.

req sub class to have the super class in its brackets

9
New cards

oop

object oriented programming - class, attributes and methods

10
New cards

ssh

secure shell

11
New cards

seaborn

a Python data visualisation library built on top of Matplotlib that provides a higher-level interface for creating attractive and informative statistical graphics

12
New cards

pandas

an extension of Python to process and manipulate tabular data

13
New cards

matplotlib

a Python library that allows users to generate a wide range of static, animated, and interactive visualisations, such as line graphs, bar charts, and scatter plots, from numerical data

14
New cards

num.py

is a Python library used for efficient numerical computing, providing support for arrays, matrices, and mathematical operations on large datasets

Faster than standard Python lists

15
New cards

module

file containing Python definitions and statements; could contain one or more classes; the name of the module is the name of the file (with .py on the end)

16
New cards

isinstance

built-in Python function used to check whether an object is an instance of a specified class or data type

17
New cards

Boolean

18
New cards

Pass by reference

for mutable data, a method of passing arguments to a function where the function receives a reference to the original object, allowing it to modify the original data

19
New cards

pass by value

for immutable data, a method of passing arguments where a copy of the value is passed to the function, so changes made inside the function do not affect the original variable

20
New cards

mutable

object whose value can be changed after it is created

21
New cards

iterators

An iterator is something that lets you go through a collection one item at a time.

numbers = [10, 20, 30]

it = iter(numbers)   # create iterator

print(next(it))  # 10
print(next(it))  # 20
print(next(it))  # 30

22
New cards

.append

a list method in Python that adds a single element to the end of a list

23
New cards

df

DataFrame (df) is a two-dimensional data structure in Python (from the pandas library) used to store and manipulate tabular data with rows and columns

24
New cards

df.head()

Prints the first few rows of the data

25
New cards

df.info()

Shows you the columns, if any columns have null data, and the variable type of each column

26
New cards

df.shape

Will give you the size of the data (number of rows x number of columns)

27
New cards

df.mean()/.median()

Gives you the average value of each column

28
New cards

df.std()

Gives you the standard deviation of each column

29
New cards

df.unique()

Gives you the standard deviation of each column

30
New cards

whitespace sensitive

A language where spaces, indentation, and newlines affect the syntax. In Python, indentation defines code blocks.

31
New cards

Dictionaries

dictionary_name = { 'key_1': 'value_1', 'key_2': 'value_2', 'key_3': 'value_3'}

print(dictionary_name.get('key_1'))  # 'value_1'

dictionary_name['key_1'] = 20          # update
dictionary_name['key_4'] = "A"       # add new key-value pair

for key, value in dictionary_name.items():
    print(key, value)

student.keys()     # returns all keys
student.values()   # returns all values
student.items()    # returns (key, value) pairs
student.clear()    # empties dictionary

output:

‘value_1’

'key_1' 'value_1'

‘key_2' 'value_2'

'key_3' 'value_3'

‘key_4’ ‘A’

32
New cards

len()

for a string

len('hello') #5

gives number of characters

for a list

numbers = [1, 2, 3, 4]
len(numbers) #4

gives # items

for dictionaries

dict = { 'name': 'Sally', 'age': 19}
len(dict) #2	

gives number of key-value pairs

Explore top flashcards

flashcards
Filmgeschiedenis 2 (2022-2023)
134
Updated 1029d ago
0.0(0)
flashcards
Essen und Trinken
59
Updated 108d ago
0.0(0)
flashcards
Semester 1 Final: Names
37
Updated 1204d ago
0.0(0)
flashcards
A Raisin in the Sun
30
Updated 674d ago
0.0(0)
flashcards
Economics
31
Updated 1084d ago
0.0(0)
flashcards
compscipaper2.0
100
Updated 36d ago
0.0(0)
flashcards
Filmgeschiedenis 2 (2022-2023)
134
Updated 1029d ago
0.0(0)
flashcards
Essen und Trinken
59
Updated 108d ago
0.0(0)
flashcards
Semester 1 Final: Names
37
Updated 1204d ago
0.0(0)
flashcards
A Raisin in the Sun
30
Updated 674d ago
0.0(0)
flashcards
Economics
31
Updated 1084d ago
0.0(0)
flashcards
compscipaper2.0
100
Updated 36d ago
0.0(0)