Python Syntax
In this course, learn about the syntax of the Python programming language!
StartPython Syntax
Lesson 1 of 1
- 1If programming is the act of teaching a computer to have a conversation with a user, it would be most useful to first teach the computer how to speak. In Python, this is accomplished with the print…
- 2There are two different Python versions. Both Python 2 and Python 3 are used throughout the globe. The most significant difference between the two is how you write a print statement. In Python 3, p…
- 4As we get more familiar with the Python programming language, we run into errors and exceptions. These are complaints that Python makes when it doesn’t understand what you want it to do. Everyone r…
- 6One thing computers are capable of doing exceptionally well is performing arithmetic. Addition, subtraction, multiplication, division, and other numeric calculations are easy to do in most programm…
- 7Changing the contents of a variable is one of the essential operations. As the flow of a program progresses, data should be updated to reflect changes that have happened. fish_in_clarks_pond = 50 …
- 10In Python 2, when we divide two integers, we get an integer as a result. When the quotient is a whole number, this works fine: quotient = 6/2 # the value of quotient is now 3, which makes sense Ho…
- 11We have seen how to define a string with single quotes and with double quotes. If we want a string to span multiple lines, we can also use triple quotes: address_string = “””136 Whowho Rd Apt 7 Wh…
- 13Python automatically assigns a variable the appropriate datatype based on the value it is given. A variable with the value 7 is an integer, 7. is a float, and “7” is a string. Sometimes, we will wa…
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory