1 of 11

Slide Notes

DownloadGo Live

Python Vs. JavaScript

Published on Nov 21, 2015

No Description

PRESENTATION OUTLINE

PYTHON VS JAVASCRIPT

BY JANICE KANG

Variables—

Both programming languages use variables. Though, in JavaScript, they always begin with ”var,” whilst in Python, a statement before the variable name is not needed.

Photo by Matt Ephraim

Truthiness—

Both languages use “true/false,” though in JavaScript, all letters are lowercase and in Python, the first letters are capitalized: “True/False.”

Photo by evil_mel

Nothingness—

JavaScript has two values that represent nothingness: ”undefined” and “null.” Python has only one: “None.”

Numbers—

Numbers are used in both programming languages; sometimes as variables, and other times, in equations.

Photo by Improve It

Function Declarations—

In JavaScript, function declarations are also expressions and can be anonymous; the function name can be omitted. This allows a few interesting uses that Python does not have, because in Python, functions cannot be anonymous, and are not expressions, so they cannot be defined and used on the same line.

Strings—

When using Python, strings can contain letters, numbers, and symbols; they must be enclosed within quotation marks, and when using an apostrophe, you must put a blackslash before, so the rest of the string isn't messed up. In JavaScript, you cannot use only quotation marks, because then the computer will assume that is a variable. Instead, you must put it within the “text” statement and include it within parenthesis, which is then followed by the x and y position of the text.

Photo by gruntzooki

Lengths—

In JavaScript, the length (of a string) would be typed out as: str.length, whilst in Python, it would be written as: len(“message here”)

Photo by eGuidry

Arrays/Lists—

JavaScript has a built-in array type and uses square brackets, and Python uses square brackets in their “list” functions.

Photo by bengrey

Bracket Types—

In JavaScript, there are three brackets used, which are { }, ( ), and [ ]. The curly brackets are used to define the start and end of the function. They also separate code into blocks within the function. The [ ] brackets are used for arrays, and the standard parenthesis, ( ), is used for when parameters are either sent or received. And in Python, curly brackets create either dictionaries or sets, whilst square, [ ], brackets create lists. And like in JavaScript, ( ) are just the basic bracket type.

Assignments—

When using JavaScript, a variable assignment is also an expression that returns the value assigned. Though in Python, you must be careful when writing assignments to use the single “=,” as the double “==,” sign is what conveys equality in an equation.

Photo by kjetikor