Language Fundamentals Flashcards

1
Q

what are these called?: ( )

A

Parentheses

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

what are these called?: []

A

Square brackets

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

what are these called?: {}

A

Curly Brackets

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

what are these called?: ‘ ‘ or “ “

A

String

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

What are Keywords?

A

Keywords are reserved words in Python. They are used to define the syntax and structure of the python language such as def or True

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

What are Identifiers?

A

An indentifier is a name given to entities like class, functions, variable.

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

What is a class?

A

A class is a code template for creating objects.

Instance = class Snake:
...                pass
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a function?

A

A function is defined by using the def keyword:

A function is a block of code which only runs when it is called

you can pass data, known as parameters, into a function.

Example
def my function ():
      print ("hello from a function"
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a statement?

A

Instructions that a python interpreter can execute are called statements.

For example:

a = 1 + 2 + 3

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

What is a variable?

A

A python variable is a named location used to store data in the memory.

number = 10

which can be replaced at any time
number = 11

Website = “apple.com”
print(website)

It’s best practice to use lower case for variables

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

What are the four different literal collections?

A
fruits = ["apple", "mango", "orange"] #list
numbers = (1, 2, 3) #tuple
alphabets = {'a':'apple', 'b':'ball', 'c':'cat'} #dictionary
vowels = {'a', 'e', 'i' , 'o', 'u'} #set

print(fruits)
print(numbers)
print(alphabets)
print(vowels)

OUTPUT:
['apple', 'mango', 'orange']
(1, 2, 3)
{'a': 'apple', 'b': 'ball', 'c': 'cat'}
{'e', 'a', 'o', 'i', 'u'}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an f string?

A

Example:

print (f”You are {age} old {height} tall.”)

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