Placeholder Image

字幕表 動画を再生する

  • Hi and welcome!

  • We at 365 Data Science specialize in data science trainings.

  • We post videos weekly, so you can master indispensable skills for free!

  • Alright, let’s get started!

  • All right, great!

  • In this lesson, we will start coding!

  • One of the main concepts in programming is variables.

  • They are your best friends.

  • You will deal with them all the time.

  • You will use them to store information.

  • They will represent your data input.

  • Let’s say you want to have a variable x that is equal to the value of 5 and then ask

  • the computer to tell you the value of that variable.

  • So, we must tell the machine that x equals 5.

  • And this is how you could do this in Python.

  • Type x equals 5.

  • To go through the process of programming, the line that says x equals 5 is called a

  • command or a program.

  • This is just a line of text.

  • To make something out of it, we must execute it.

  • Only then will the computer carry out operations with it.

  • Press Shift and Enter (not just Enter), and a variable called x will be created and assigned

  • with a value of 5.

  • To be more precise, “equalityin Python and in programming meansassignorbind

  • to”.

  • Ok, we carried this operation, but we see nothing right now.

  • How can we ask the computer to show us the output of what we just did?

  • It would be sufficient to write x and then press Shift and Enter.

  • And here’s the result – 5.

  • Great.

  • As you can see, typing in a single line of code entails a few concepts of programming

  • simultaneously.

  • Now, let’s assign the value 8 to a variable we call y. … Alright, Shift plus Enter

  • and we can check y.

  • However, I’ll type capital Y.

  • Oh!

  • An error!

  • This shows us that Python is case sensitive, so pay attention to that.

  • It matters if you use lowercase or uppercase letters.

  • An alternative way to execute the instruction that will provide the value we assigned to

  • y would be to use the print command.

  • At first sight, it seems redundant as we showed we can just type “y”.

  • Nevertheless, this command is applied often; youll see it in most of the code produced

  • by professionals.

  • It complements the logical flow of your instructions.

  • For instance, if we sayprint y”, the machine will simply execute this command and

  • provide the value of y as a statement, and this is all a programmer must see sometimes.

  • The last thing I’d like to share with you in this lecture is you can assign a certain

  • number of values to the same number of variables.

  • To create the variables x and y, we have to assign two valuessay, 1 and 2.

  • We must separate each of the variables and each of the values with a comma.

  • The parentheses here are not obligatory, but we use them to improve the readability of

  • our code.

  • Now, if I call x or y separately, the computer will correctly give me their respective values.

  • It is very important that the number of variables on that line equals the number of values;

  • otherwise, you will get an error message.

  • See?

  • Great!

  • If you found this video interesting and want to gain an edge in your career, make sure

  • to like, comment, and subscribe!

  • And don’t forget to check out some of our other videos for another quick win in the

  • data science skills department!

Hi and welcome!

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

A2 初級

初心者のためのPythonチュートリアル。Pythonの変数 (Python Tutorial for Beginners: Python Variables)

  • 2 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語