1.0 Introduction To Python
1.0 Introduction To Python
PYTHON
Senior 1 Science Class, 2nd semester
LESSON 1
INTRODUCTION TO PYTHON
•Why Python?
•print() command
WHAT IS PYTHON?
print() command
- print() command is used to display the wordings in the (“”)quotes.
PRINT() COMMAND
Code
Line 1 Comment
Line 2 Comment
Line 3 Code
Outcome
- If quote are to be displayed (Single quote or double quote), the alternate quote can be used to contain the words.
- print(‘Hello “world”’)
- print(“Hello ‘world’”)
PRINT() COMMAND
Code Outcome
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 1: will show Sabah with a space at the end. The parameter end=“ “ will put a space at the end of the line.
Line 2: will combine two wordings together. A space will put in between the words
Line 3: similar to line 2, two worlds will combine, but no space will put in between the words
Line 4: a blank print command will display a blank line in the outcome
Line 5: The parameter sep=‘-’ will put a – symbol in between words
Line 6: the parameter end=“@” will put @ symbol at the end of the line
Line 7: the parameter sep=“.” will put . Symbol in between the wordings.
Note:
end parameter will make the next line displayed at the same line. E.g (line 1 and line 2 are displayed at the same
line)
PRACTICE TIME
PRACTICE
What will be the outcome of this code? What will happen if we change the end=“” to
1. end=“~”
What will be the outcome of this code? What will happen if we change the
2.
sep=“.” to sep=“/”. Can we change to sep=‘/’ ?
What will be the outcome of this code? What will happen if we change the
3.
‘”WARNING!!!”’to ”’WARNING!!!’”
ASSIGNMENT
ASSIGNMENT
Outcome
Instruction
Try produce above outcome from what you have learn.
Your code must have
1. end=
2. sep=
Take a screenshot of your full screen (Please don’t crop) and submit into google classroom