Syntax Week 1 Flashcards Preview

COMPSCI 101 > Syntax Week 1 > Flashcards

Flashcards in Syntax Week 1 Deck (15)
Loading flashcards...
1
Q

Variable

A

A storage location that can hold integers, floating points and strings

2
Q

Variable Naming Rules

A

Choose a meaningful name
Lower case letters
Join words with an underscore
Cannot be a keyword

3
Q

=

A

Used to assign a value to a variable

4
Q

*

A

Multiplication

5
Q

/

A

Division

6
Q

**

A

Exponentiation

7
Q

Print()

A

Print function
Arguments are the information that is put inside the parentheses
When the parentheses contain no argument, it prints a blank line
Automatically goes to the next line after print function is complete
A print statement can print more than one variable if a comma is used between

8
Q

String

A

A string consists of characters enclosed in a ‘ ‘ or “ “, as long as it is consistent

9
Q

Sep=“”

A

Is an optional argument that changes the separation between variables in a print function

10
Q

Docstring

A

A special kind of string used to describe the program, and is not a part of the program
Created with “”” “””
Docsting contains author and description of what the program does

11
Q

//

A

Floor division

Performs normal division but ignores everything after the decimal point, so gives an integer

12
Q

%

A

Modulus
Performs division and gives the remainder
If denominator larger than nominator, the it gives the nominator

13
Q

B E DMMF AS

A

Brackets
Exponents
Mulitiplication, Division, Modulus & Floor Division
Addition & Subtraction

Ones of same priority are worked out from left to right in a sequence

14
Q

Integer

A

A numerical value that is a whole number

15
Q

Floating point

A

Decimal