Posts by [email protected] (24)

Printing a paragraph to the console

<h2>Printing a paragraph to the console</h2> <p>So you've learned to print numbers, words, and sentences to the console. Now, you want to print a paragh. Writing multiple <code>print()</code> functions again and again and again might be tedious.</p> <p>So, Python has a solution for that problem. You can use triple double quotes (""") or triple single quotes (''') to enclose your paragraph.</p> <div class="kodeEditor">print("""Give me Harry Potter, and none shall be harmed. Give me Harry Potter, and I shall leave the school untouched. Give me Harry Potter an you will be rewarded.""")</div> <p>Up next: <a href="" style="color: #007bff !important;">Escaping Characters</a></p>


<p> Welcome! This is going to be a hands-on, free, and world-class tutorial on <a href="">Python</a>! There is no need for any installation because this course includes a code editor, which allows you to edit and write code in the browser, without needing to install anything! </p> <h2>What is a programming language?</h2> <p> A programming language is a language that computers can understand. You can&#39;t just write English and expect a computer to understand. Programming languages are typically easy, and Python is one of the easiest and one of the most popular. </p> <p>Without any further ado, let&#39;s get started with Python.</p> <h2>Input</h2> <p>Anything that you send to a computer is called an instruction.</p> <h2>Output</h2> <p>Anything that a computer sends to you is called output.</p> <h2>Let's get started</h2> <p>Without any further ado, let's get started with Python.</p> <p> The first instruction we&#39;re going to be learning is called <code>print()</code>. This instruction instructs the computer to display whatever you wrote between the parenthesis on the screen. </p> <div class="kodeEditor">print(100)</div> <p>We've typed "100" in between the parenthesis for you. Click on "Run" to run the code.</p> <p>The area where the number 100 appeared is called the console.</p> <p>What do you see? After waiting for a few moments of setup, you'll see the output: 100 printed on to the console.</p> <p>The things that you put inside those brackets are called values. And <code>print()</code> is a function because it has those brackets. There are also instructions that you can give to a computer that don't have brackets, and this is not one of them.</p> <p>We've seen how to print numbers to the console, now what about words? We can do that too!</p> <div class="kodeEditor">print("My name is Joe.")</div> <p>Notice that numbers can be written just like that in the parenthesis, while words and sentences have to be written within quotes.</p> <p>Sentences can be written within single quotes (') or with double quotes ("), and that is left to you. It will not change the output in any way</p> <p>We can see that the sentence "My name is Joe." has been printed to the console.</p> <h2>It's your turn now</h2> <p>Print the sentence "Joe. That's my name." to the console.</p> <div class="kodeEditor"></div> <p>Up next: <a href="" style="color: #007bff !important;">Printing a paragraph to the console</a></p>

First Previous 1 2 3 4 5 Next Last