文本记录English

Python for Beginners – Full Course [Programming Tutorial]

4h 40m 1s43,598 字数7,311 segmentsEnglish

完整文本记录

0:00

in this full course you will learn the

0:01

basics of python programming

0:03

i'm beau carnes with freecodecamp.org

0:06

i've previously created one of the most

0:07

popular javascript courses on youtube

0:10

and i've created many python tutorials

0:13

now i've created this complete python

0:15

course for beginners you don't need any

0:17

previous programming experience to

0:19

follow along and all you need to code in

0:21

python is a web browser in this course i

0:23

will teach you all the core aspects of

0:25

the python programming language and i

0:27

will simplify the more complex topics

0:30

python is considered one of the most

0:31

popular programming languages in the

0:33

world and it's only growing in

0:35

popularity python excels in a wide

0:37

variety of scenarios such as shell

0:39

scripting task automation and web

0:42

development and it's also the language

0:44

of choice for data analysis and machine

0:46

learning but it can also adapt to create

0:49

games and work with embedded devices

0:52

we're going to jump right into it so you

0:54

can start coding your first python

0:55

program as soon as possible to get

0:58

started quickly we'll use a replit which

1:00

is an online ide that allows users to

1:02

code and run programs in a variety of

1:05

different languages all in a web browser

1:08

and later i'll show you how to get

1:09

python set up on your local operating

1:11

system after the first project i'll go

1:14

into more detail about each of the main

1:16

features of python the section is

1:18

comprehensive and detailed and in the

1:20

final section you will use what you've

1:22

been learning to code a blackjack game

1:24

with me guiding you every step of the

1:26

way throughout the course there will be

1:28

a little repetition of some of the key

1:30

python programming concepts to make sure

1:32

you have a deep understanding of the

1:33

language so let's get started we're

1:36

going to start by creating a simple rock

1:38

paper scissors game and we'll start by

1:41

going to replit.com replied provided a

1:44

grant that made this course possible and

1:46

replie is going to make it super easy to

1:48

get up and running really quickly so you

1:50

can either sign up or log in

1:53

and create an account i'm just going to

1:54

use my google account

1:56

okay now that you're logged into replit

1:59

you can either just click the create

2:01

button or this plus button over here to

2:04

create a new replit and i'll make sure

2:06

to create a python replit but you can

2:10

see you can also select all sorts of

2:12

different programming languages oh these

2:14

are just the ones that start with the

2:15

word python but so there's there's tons

2:18

of different programming languages you

2:19

can select but in this case we are just

2:21

going to use python and then i'll click

2:24

create reple

2:29

okay so let me just kind of show off

2:31

replica a little bit

2:33

this is where we're going to create our

2:34

python code i'm going to zoom in just a

2:36

little bit so we're going to write the

2:38

code right here and then we can see some

2:40

output over on the right side and then

2:42

you can create different files over on

2:44

the left side here

2:46

and then there's some other things like

2:48

you can connect to version control

2:50

and

2:51

if you have environment variables we're

2:52

not even going to be discussing those in

2:54

this course there's a debugger you can

2:56

connect to a database and just some

2:58

other things but we're mainly going to

3:00

just be using this main.pi program to

3:02

write our program and we're going to see

3:04

the results in the console so i'm just

3:06

going to close this files window so

3:09

it's a little bigger here

3:11

i'm going to start off by showing you

3:13

how to create a variable with python so

3:17

this is a rock paper scissors game and

3:19

there's going to be a players a player

3:21

is going to have a choice and a computer

3:23

is going to have a choice so i'm going

3:25

to create a variable called player

3:29

choice

3:30

and i'm going to set that equal to

3:33

rock

3:34

so let's look at a few components about

3:36

this this is the variable name player

3:39

choice

3:40

and you can see

3:42

if you

3:43

we use an underscore that's just kind of

3:45

the convention for python to use an

3:48

underscore if you're going to have a

3:49

space in the variable name and we're

3:51

going to assign it that's what this

3:53

equal sign this is the assign operator

3:55

and we're going to assign it to a string

3:58

a string is just a word or a collection

4:00

of characters like rock and we're going

4:02

to put quotation marks around it now we

4:04

could have also used a single quotes

4:06

instead of double quotes as long as you

4:08

use the same quote on each side that's

4:10

what's important so we've now created a

4:13

variable

4:14

called

4:15

playerchoice and assigned it to rock and

4:18

now we can reference this variable later

4:20

and whenever we reference the variable

4:22

called playerchoice it's going to

4:25

the code is going to automatically

4:27

replace that player choice with rock

4:31

so this is going to be a very

4:33

interactive project i hope you're

4:36

following along i hope you have already

4:38

got replit loaded up like this now

4:40

throughout this project i'm going to

4:42

tell you what the next thing to do is

4:45

and i want you to try doing it yourself

4:48

before you watch what i'm going to do so

4:52

periodically you'll want to pause the

4:53

video

4:55

based on and what i say you and try to

4:57

implement what i say

4:58

before you come back to the video and

5:00

watch me implement it and see if you've

5:02

implemented the the same way

5:05

so i'm just going to zoom in one more

5:06

time and

5:08

this is the first thing i want you to do

5:10

see if you can make another variable on

5:13

the next line so you're going to press

5:14

return or enter to go to the next line

5:16

and this variable should be called

5:18

computer choice and you should set it to

5:21

equal

5:22

paper

5:24

okay so you can pause the video and see

5:25

if you can make a variable called

5:26

computer choice and set it to equal

5:28

paper

5:31

so here it's pretty simple here it's

5:33

going to start simple but it's going to

5:35

get harder as we go so computer choice

5:38

equals

5:40

paper okay so like i said it's starting

5:42

simple but it's going to get more

5:43

complex as we go along

5:45

if you've done that you've now written

5:47

your first line of python code in this

5:49

course

5:50

okay now i'm going to talk about

5:52

functions

5:53

a function is a set of code which only

5:56

runs when it is called

5:58

so i'm going to show you how to put this

6:00

code into a function

6:03

now one thing about python is that

6:05

indentation is very important

6:08

so after we create a we define the name

6:11

of a function any line of code that's

6:14

indented the same amount is considered

6:16

within that function

6:18

so i'm going to create a new line of

6:21

code at the top and i'm going to call it

6:24

get

6:26

choices

6:31

okay so we define the function with def

6:35

and get choices and i'm going to select

6:37

all these these two lines of code at the

6:39

same time and just press the tab key and

6:42

that's going to indent all these the

6:44

same amount

6:46

and you can see sometimes they'll be

6:48

squiggly lines and if you hover over

6:50

some of the squiggly lines it will tell

6:52

you something in this case it just says

6:54

the local variable called player choice

6:56

is assigned to but never used that's not

6:59

necessarily bad it's just it's just

7:01

telling us that usually if you create a

7:03

variable you're going to want to use it

7:04

later well we are going to use it later

7:06

we just haven't gotten to it yet so

7:08

sometimes the squiggly lines will

7:10

indicate there's some sort of error in

解锁更多

免费注册以访问高级功能

互动查看器

观看带有同步字幕、可调节叠加层和完整播放控制的视频。

免费注册以解锁

AI 摘要

获取由 AI 立即生成的视频内容摘要、要点和结论。

免费注册以解锁

翻译

一键将字幕翻译成 100 多种语言。以任何格式下载。

免费注册以解锁

思维导图

将字幕可视化为交互式思维导图。一目了然地了解结构。

免费注册以解锁

与字幕聊天

提出关于视频内容的问题。直接从字幕中获取由 AI 驱动的答案。

免费注册以解锁

从您的字幕中获得更多

免费注册并解锁交互式查看器、AI 摘要、翻译、思维导图等。无需信用卡。