Output
Part of the Fundamentals section of Coddy's Python journey — lesson 24 of 77.
We have already seen how to output something, but let's recap.
In programming it's often called "printing" to output something.
In Python, to print something to the screen we use print()
For example,
print("Hello")The above example prints "Hello" to screen.
Recall that you must enclose what you want to print with "" or with '', it is a string inside the print().
Challenge
BeginnerWrite a program that prints "I love Python programming"
Cheat sheet
To print to the screen in Python:
print("Your text here")Key points:
- Use the
print()function - Enclose the text in quotation marks (either
""or'') - The text inside quotes is called a string
Try it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
4Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Logical Operators Part 48Loops
For LoopWhile LoopBreakContinueRecap - FactorialThe Range FunctionNested LoopRecap - Dynamic Input3Operators Part 1
Arithmetic OperatorsModulo OperatorArithmetic ShortcutsRecap - Simple MathComparison Operators9Functions
Declare a FunctionArgumentsReturnRecap - Sigma FunctionRecap - Validation FunctionDefault Values12Iterating Over Sequences
Iterating Over ElementsThe Enumerate FunctionIterating Over Strings Part 1Iterating Over Strings Part 2