Lecture 0 - Functions, Variables Flashcards

1
Q

are verbs or actions that the computer or computer language will already know how to perform

A

Functions

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

This function takes arguments

A

Print()

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

a function that takes a prompt as an argument

A

Input()

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

A container for a value you set within your own program.

A

Variable

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

Variable Syntax

A

name = input(“What’s your name? “)

print(“hello,”)
print(name)

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

A way for programmers to track what they are doing in their programs and even inform others about their intentions for a block of code.

A

Comments

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

Comments Syntax

A

Ask the user for their name

name = input(“What’s your name? “)

print(“hello,”)
print(name)

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

What does Str stand for?

A

String

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

Are variables that are defined in the function definition. They are assigned the values which were passed as arguments when the function was called, elsewhere in the code.

A

Parameters

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

A type of escape character that will create a new line when used

A

\n

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

Unique indicator that identifies a string is used for formatting

A

F Strings

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

F Syntax

A

print(f”hello, {name}”)

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

A method that removes spaces at the beginning and at the end of the string

A

Strip()

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

Strip() Syntax

A

name = name.strip()

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

A method returns a string where the first character in every word is upper case.

A

Title()

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

Title() Syntax

A

name = name.title()

17
Q

An integer is referred to as an

A

Int

18
Q

A real number that has a decimal point in it

A

Floating Point Value

19
Q

This function converts the specified value into a floating point number

A

Float()

20
Q

This function returns a floating point number that is a rounded version of the specified number, with the specified number of decimals.

A

Round()

21
Q

Round() Syntax

A

round(number, digits)

22
Q

A function is created or defined using this keyword

A

Def

23
Q

A statement to make your functions send Python objects back to the caller code. These objects are known as the

A

Return Value

24
Q

Return Syntax

A

def main():
x = int(input(“What’s x? “))
print(“x squared is”, square(x))

def square(n):
return n * n

main()