what is print used for
The print() function prints the specified message to the screen, or other standard output device
how to use print
1) Use the syntax print()
2) Insert a specified message between the parentheses.
3) If string use double quotation marks before and after the message.
4) If it is a numeric value, the before is unnecessary.
1/8
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
what is print used for
The print() function prints the specified message to the screen, or other standard output device
how to use print
1) Use the syntax print()
2) Insert a specified message between the parentheses.
3) If string use double quotation marks before and after the message.
4) If it is a numeric value, the before is unnecessary.
TWO DIFFERENT DATA TYPES AND DEFINITION
Integer data types→ A data type that stores whole numbers, either positive or negative, without decimal points.
String data type → A data type that store sequence of characters, digits or symbols enclosed between the double quotes that is treated like text.
A boolean data type → a data type that can store only two values: true or false. It's used to store and represent logical values
The float data type → data type that stores numbers with fractions
WHAT DO WE USE INPUT FOR
We use input to fetch an input from the user.
HOW TO USE INPUT()
Variable assigned to input() function
Inside the parentheses of input(), we provide a prompt (enclosed in double quotation marks ("").
The user's input is stored in the variable.
VARIABLES
VARIABLES → memory locations whose value may change during execution of the program
variable name rules
A variable name
consist of letters, digits, and underscore
Start with a letter, underscore. Not digit
Cannot have a space in between
Cannot be a keyword
Python → case sensitive
Uppercase different to those in lower case
ASSIGNING MULTIPLE VALUES TO MULTIPLE VARIABLES EXAMPLE
x,y,z = 2,5,”hello”
x=2
y=5
z=”hello”
ASSIGNING SAME VALUE TO MULTIPLE VARIABLES
x = y = z = 25