other computing Flashcards

1
Q

Open

A

file = open(“quick.txt”, “_”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Read

A

file = open(“quick.txt”, “r”)
quicktext = file.read()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Close

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Write (overwrite)

A

file = open(“quick.txt”, “w”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Append (add to)

A

file = open(“quick.txt”, “r”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Turtle commands

A

All on the PLS.
Import turtle with import turtle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

List

A

a type of data structure that can be used to manipulate the elements they contain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Array

A

a kind of data structure that can hold a number of items grouped together. it contains a number of items grouped together, and named using a single identifier, however can only hold the same data type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Procedures

A

Carries out an action but doesn’t return a value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Functions

A

Carries out an action and returns a value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Data structure

A

store data in an organised and accessible way. They can be static or dynamic.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Dynamic data structure

A

more flexible. The memory capacity is not fixed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Static data structure

A

reserves memory locations for a set amount of data. Their size cannot change.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

String format

A

print(”Alice has {} cupcakes.”.format(5))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Record

A

Stores a collection of attributes/fields for a single entity.
Static data structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Database

A

Stores many records for a single entity

17
Q

How to do a record in python

A

Use a dictionary to represent a record
player1 = {“username” : “rockstar”,
“password” : “6goatsEating”,
“score” : 5328}

player2 = {“username” : “dynomouse”,
“password” : “Skibidi”,
“score” : 8594}
player3 = {“username” : “australiahead”,
“password” : “FanumTax”,
“score” : 9999}

players = [player1, player2, player3]
print (players)

18
Q

Linear search

A

Goes through every item in a list to see if it’s correct

  1. Take a list of data and an item that is being searched for (the search item)
  2. Repeat steps 3-5 starting from the first item in the list, until you find the search item or until the end of the list is reached:
  3. Compare the item at the current position to the search item
  4. If the item at the current position is equal to the search item, then stop searching.
  5. Otherwise, go to the next item in the list.
19
Q

Binary search

A
  1. Take an ordered list of data and an item that is being searched for
  2. Maintain a range of items where the search item might be found. Initially, set the range to be the entire list.
  3. Repeat steps 4-8 until you find the item you are searching for or there are no more items to check (the range is empty):
  4. Find the item in the middle of the range (the midpoint item).
  5. Compare the midpoint item to the item you are searching for.
  6. If the midpoint item is equal to the search item, then stop searching.
  7. Otherwise, if the midpoint item is less than than the search item, change the range to focus on the items after the midpoint.
  8. Otherwise, if the midpoint item is greater than than the search item, change the range to focus on the items before the midpoint.
20
Q

Bubble sort

A

Bubble sort works by repeatedly going through a list, comparing adjacent items and swapping the items if in the wrong order.

21
Q

Merge sort

A
  1. Take a list of data to be sorted.
  2. Repeatedly split the list in half (life) until each item is in a list of it own.
  3. Repeat steps 4-5 until all lists have been merged.
  4. Take two lists of data to be merged.
  5. Create a new empty list for the merged items.
  6. Repeat steps 7-9 until one of the lists of items is empty.
  7. Compare the first items of the two lists.
  8. Place the item that is lower into the merged list in the next available position.
  9. Then place each item from the remaining list into the merged list in order.