Download presentation
Presentation is loading. Please wait.
1
Hello World! Syntax
2
What is syntax? Syntax is the set of rules that determine the correct structure of a language. Our own language has rules, what are some rules, which when not followed, can cause confusion? Let’s eat grandma! A panda eats shoots and leaves Most of the time travelers worry about luggage
3
Python Syntax “ “ Quotes go around words that don’t change
( ) Parentheses go around what you print or input input and print are special words with meaning in Python = An equals sign assigns a value to a variable , Commas are used to separate the things that print out
4
Let’s write a program print("What's your name? ") name = input( ) print("Hello, ",name,"!") Save the program as “Hello” Then right click on file and open
5
Let’s modify our program…
Modify the program to ask what day it is and then respond Today is _____ . filling in the blank with the day you typed in. Notice that there’s a period at the end of the sentence.
6
Abstraction in coding When you give the command to print, what really happens? information stored in the computer’s memory appears on the screen if there are multiple things to print, separated by commas, the computer has to display all of them one after the other the computer has to figure out where the information is stored in its memory the computer has to calculate where the next available space on the screen is. the computer has to translate the binary code in the computer’s memory into dots on the screen for each symbol, one at a time. Do we need to know all of these steps that happen in order to use the print function? No. That’s abstraction. You don’t need the details “under the hood” to make it work.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.