Computer Science Flashcards

(31 cards)

1
Q

How do you print something

A

print(“enter code”)

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

How do you save something as a variable?

A

x = 30

(X is the variable)

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

Does indentation for python matter?

A

Yes, it is important for indicating a block of code.

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

What is a comment and what symbol is used for it?

A

It is a way to put something into a code that won’t be read. It starts with a pound sign.

Ex:
# this code prints your name
print(input(“Enter your name”))

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

How do you input something.

A

variable = input(“input here”)

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

How do you input a number?

A

number = int(input(“enter a number”))

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

What is the difference between x + 1 and x=x+1

A

The first adds one to the variable, but the second one actually changes the variable.

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

how do you find a random number?

A

import random
#then do this
random.randint()

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

How do you get a remainder from division with the % operator?

A

remainder = 10 % 3
print(remainder)
#output = 1

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

How do if - else blocks work

A

if the code satisfies a certain criteria something (if) then something will happen and if not (else) then something else will happen

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

How do you put something to a power in python

A

powers = pow(3 , 4)

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

How do you do the square root of something

A

Import math

math.sqrt(9)

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

What is the difference between a numeric variable and a text string

A

Numbers need int, text strings need quotes.

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

What does the function len() do?

A

It finds the length of something; a string, or a list item.

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

What does the function int() do?

A

output = 9

It rounds a number down to the nearest integer.

int(9.9)
#output = 9

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

What does the function str() do?

A

it converts something into a string
Ex:
Str(99)
#output = ‘99’

17
Q

How do you show addition, subtraction, multiplication and division?

A

+ , - , * , /

18
Q

What is an example of an algorithm?

A

Step by step instructions to do something. An example is a morning routine or a daily schedule.

19
Q

How do you find the length of a list?

A

len(thislist)

20
Q

How do you put something into a list?

A

bradylist.insert(1,”code”)

21
Q

How do you remove a list item?

22
Q

How do you add something to the end of a list?

A

mylist.append(“arrested”)

23
Q

If you wanted to find the 3rd item of a list, what would you do?

A

itemthree = mylist[2]

24
Q

What does a while loop do?

A

Until a certain thing happens, it will run code.
Ex:
while x < 4:
Print(x)
x = x + 1

25
How do you send something from the main function to the other function?
mathpractice(num1, num2)
26
How do you send something back to the main function?
return bears
27
How do you use readline() and readlines() functions?
Read line prints line by line while read lines prints it into a list. #assuming that the list is called list1: Variable = list1.readline Variable2 = list1.readlines Print(variable) Print(variable2)
28
Microsoft Access- why do a sum vs a count?
Sum adds all totals in a numeric field Count determines entries in a table/query result set
29
Microsoft access- why group data in a query?
to organize large data sets effectively
30
Microsoft access- why sort data in a query?
readability and aesthetics
31
Microsoft access- Why combine tables, and what is it about table designs that make combining useful?
It allows it to be more comprehensive and easier to find tables. It is easy because you can link tables using shared columns.