From the course: Python for JavaScript Developers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Strings and formatting: Python vs. JavaScript - Python Tutorial
From the course: Python for JavaScript Developers
Strings and formatting: Python vs. JavaScript
- [Instructor] So when you look at it from 1000 miles away, strings in JavaScript and Python behave somewhat similar. So I wanted to start with an example here in chapter 02-04 just to make sure we're all on the same page. So this is some modern JavaScript using string interpolation, and we define a constant which is my name, Ronnie. And then we create a greet. So we basically interpolate the name into the greeting. So this could be modified in other places. We then console log this. So this is, I guess, a good starting point. So we'll move on to looking at this in Python and building on this example. So let's head over to the terminal and run this. So here I am at my terminal and I'm going to type in Node, since this is a JavaScript file, ch_02_04.js and I get a hey Ronnie printed out. So let's clear that and let's head over and look at some Python. So on line one, you'll see that I use all caps for my constant. We…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Why style is crucial5m 44s
-
(Locked)
Numbers, numeric types, and decimals4m 58s
-
(Locked)
Migrating from arrays to Python lists, tuples, and dictionaries8m 20s
-
(Locked)
Strings and formatting: Python vs. JavaScript3m 38s
-
(Locked)
Python slices4m 11s
-
(Locked)
Challenge: Port the code1m 17s
-
(Locked)
Solution: Port the code1m 43s
-
-
-
-
-