IT-Phython 2 Flashcards

(6 cards)

1
Q

What is a Boolean?

A

A data type that represents one of two values: True or False

Boolean values are often used in conditional statements and logical operations.

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

What does casting refer to in programming?

A

The process of converting one data type to another

Example: int(input(“Enter a number”)) converts a string to an integer.

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

Define a function in programming.

A

A pre-made block of code designed to perform a specific task

Examples include print() and input().

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

What is the purpose of the input function?

A

A function that prompts the user to enter data, which is then stored as a string

Example: input(“What is your name?”).

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

What does the print function do?

A

A function used to display output on the screen

Example: print(“Hello World”). Also known as print statement.

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

What is a syntax error?

A

An error caused by breaking the rules of the programming language, such as incorrect punctuation or spacing

Syntax errors must be corrected for the code to run properly.

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