Intro to Programming Flashcards

1
Q

The output of the input function is always a

A

string

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

pros/cons of python

A
  • can quickly write programs
  • no overhead
    cons: not as fast/efficiently
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why to not use word processor?

A

screw up the formatting

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

Process for programs to be ready by computer

A

program is yranslated into binary machine language

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

do not click on the previously created program to open it because….

A

operating system will try to run python programs (not allow you to edit it)

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

Naming files (2)

A
  • no spaces
  • Use alphabetical characters, numbers may be used but the first number is only alphabetic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Variables (3)

used to do what?+what happen if u put anothe info in+accesibility?

A
  • Used to store information (temporary)
  • can store one piece, putting another peice can overwrite previous entry
  • at most the info will be accesible as long as the program runs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

type of info that can be stored in variables: (3)

A
  1. integers (whole number)
  2. floating point (fractional)
  3. strings (character info)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The assignment operator+ tell me about photocopying (y=3 x=y y=6)

A
  • not the same as equal
  • you change y when y=x, x doesnt change
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When naming a variable (3)

A
  • names must start with a letter and should not behin with an underscore
  • should be all lower case
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

division symbol

A

/

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

integer division symbol+ what it does

A

//
9//2 ->4

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

exponent symbol

A

**

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

order of operation (2)

A
  1. brackets, exponent, multiplication/division/modulo, addition/subtraction, assignment
  2. If there are multiple operations that are on the same level then prescendance goes from left to right
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Triple quote

A

Prints exactly what you typed

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

bits

A

A bit in computer science holds the information of a ‘yes-no’ question - 1 means yes, 0 means no.

When you put a few bits together you can represent a larger number (think combinations).

With a larger number you can represent letters from an alphabet or colors on a screen or volume levels of sound and music.

And there you have it — a computer system, built on the bit.

17
Q

converting float to integers will

A

not round the number, just cut off

18
Q

”+ with strings”

A

Concatention

19
Q

+ with non strings

A
  • can do it with integers and float
  • literally adds it
20
Q

+ with integers:
what happens if:

A
21
Q

print format with format specifiers:

A

print (“course: %s%d” %(num, sum))

22
Q

print format with format specifiers:

A

print (“course: %s%d” %(num, sum))

23
Q

%d

A

integer

24
Q

%f

A

floating point

25
Q

What does print (“$3s-3%s” %(“ab”, “ab”)) look like?

A
26
Q

positive integer add leading spaces…

A

before the information to display (Right alighn)

27
Q

print (“%f%%” %(100)) gives

A

100.000000000%

28
Q

\a

A

alarm causes the program to beep

29
Q

\n

A

new line moves cursor to begining of the next line

30
Q

\t

A

tab moves curesor forward one tab stop

31
Q

'

A

single quote prints a single quote

32
Q

'’

A

prints a double quote

33
Q

\

A

prints one blackslash