Python Tutorial for Beginners 8: Functions

Python Tutorial for Beginners 8: Functions

Corey Schafer

7 лет назад

1,123,961 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Ricardo Torrellas
Ricardo Torrellas - 21.09.2023 04:12

Good video

Ответить
Patrick Wheeler
Patrick Wheeler - 15.09.2023 01:38

Excellent material, helping me grow.

Ответить
Noel Kitonga
Noel Kitonga - 15.09.2023 00:42

This is what I came for functions, objects, and classes.

Ответить
Mohammadho3ein
Mohammadho3ein - 14.09.2023 17:01

Thank you so much for toturials🙏🙏🙏

Ответить
Mochi Blue
Mochi Blue - 19.08.2023 11:44

Thank you Mr.Schafer

Ответить
Kianush Ghahari
Kianush Ghahari - 03.08.2023 13:41

This is how a beginner's course should be. Fast, clear and straight to the point with no new or confusing stuff that leaves one hanging. People would pay for your videos on a source like UDEMY and as a person living in a country with no online payment possibility I seriously appreciate you work. And the fact that it's actually an Englishman teaching the course is just cherry on top. Cheers Mr.Schafer.

Ответить
Syeda Saima Hossain
Syeda Saima Hossain - 15.07.2023 15:32

Please increase the font size or atleast zoom in. Literally can't see anything which is super annoying.

Ответить
Dan Martens
Dan Martens - 08.05.2023 05:33

too tiny

Ответить
Naive Statistic
Naive Statistic - 22.04.2023 01:11

Can't imagine I actually understand it, thank you for your great teaching

Ответить
sulaiman1408
sulaiman1408 - 17.04.2023 00:01

Thank you, Corey. Every time I search on something about python, I hope I find a tutorial from you. You are the best.

Ответить
Ecommerce by Kashif Hussain
Ecommerce by Kashif Hussain - 07.04.2023 07:46

In: def hello_func():
return 'Hello Function.'
hello_func()

Out: 'Hello Function.'

Why Jupyter Notebook returning value , and this is not supposed to. but Sublime does follow your out put.

Ответить
H K
H K - 01.04.2023 03:01

"Its not important you understand how a leap year is calculated" Zybooks expects you do know the equation in a lot of instances, which makes it harder to understand how to get to said outputs. Your videos have helped as a refresher as I'm at the end of my python course. I get most of it, I can't write it to save my life. I hope after watching these videos, I'll be able to churn out code easier from word problems I've been presented with. Thank you for for these lessons.

Ответить
Ivan Mironov
Ivan Mironov - 31.03.2023 19:10

Once he started going into the args and kwargs, and talking about the whole leap year thing, he completely lost me. Felt more like it was dragging on and on with lots of technical rambling.

Ответить
Mahesh Kumar Selveraj
Mahesh Kumar Selveraj - 21.03.2023 07:17

Your lessons are comprehensive. Your instructions are thorough and exact. Your lectures clear up misunderstandings and create clarity. Each of your videos demonstrates your sincerity and absolute passion to educating! I must commend you. Please take a bow... Mr. Corey, please

Ответить
Jake Ambrose
Jake Ambrose - 19.02.2023 22:34

You completely lost me.

Ответить
lilian mulinge
lilian mulinge - 16.02.2023 15:45

This is what i was looking for. thanks for the tutorial.

Ответить
moadsen
moadsen - 08.01.2023 13:55

This was the best explanation of the *args and **kwargs parameters I've ever heard. Many, many, many thanks for your videos.👏👏👏👏👏

Ответить
XD_Cat
XD_Cat - 25.12.2022 12:54

thanks for such a good python tutorial ❤

Ответить
DoodahGurl
DoodahGurl - 21.12.2022 02:02

All the previous videos, everything was crystal clear and so good! Then halfway through this video, everything went downhill. LOL! I copied the leap year code and it worked fine, but when I added that print line like you did and the year/month, it errored out with a "syntax error" complaining about """Return true for leap years, False for non-leap years.""" ....UPDATE: Turns out I'm getting the error in Pycharm, but when I ran it on IDLE, it works fine (found out asking chatGPT why I was getting that error. LOL)...UPDATE2: Okay, problem is with me. I had used my .py file in Pycharm to take notes, thinking """ """ is used to comment multiple lines, which worked fine previously, but it apparently conflicts when I use your code which also contains """ """. Moving the code to it's own .py file ran fine.

Ответить
Mahmoodul Hassan
Mahmoodul Hassan - 19.12.2022 05:40

Very informative and exciting. Thanks

Ответить
Ryan
Ryan - 02.12.2022 13:01

This is probabely the best Python tutorial I've ever watched. Thank you so much.

Ответить
johan karlsson
johan karlsson - 04.11.2022 23:33

In one point in my program when using a function with print i will get the following: at 0x7f79d0635f70. What does this mean?

Ответить
JESUS MENDOZA
JESUS MENDOZA - 12.10.2022 23:45

hey man great tutorial, but i would've appreciated it more if the font was bigger.. or if you could've zoomed in some. Thanks

Ответить
Mega No
Mega No - 09.10.2022 02:22

So I am playing around with this example, and I want it to print 'yes' when it is a leap year and 'no' when it is not. It is printing 'yes' alright when I input 2020, but it is giving me no of days 28 for February 2020 instead of 29. Any body knows why?

month_days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def is_leap(year):

if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0):
print('Yes')
else:
print('No')

def days_in_month(year, month):

if not 1<= month <=12:
return 'Please enter a valid month'

if month == 2 and is_leap(year):
return 29

return month_days[month]

print(days_in_month(2020,2))

When I run the code I get:

Yes
28 ---> Should be 29

Ответить
Test_Popytu
Test_Popytu - 08.10.2022 00:31

Best tutorials for simple reason:
topic is nailed by explaining core of the concept and proving an example that needs a 'light-bulb' in order to be solved

Ответить
Milark
Milark - 06.10.2022 19:07

This part right here, especially the meaning of 'return' is a point I often got stuck on during my previous attemps at learning python. But I understand it incredibly clearly right now.

Ответить
Glitchy
Glitchy - 06.10.2022 14:11

Boy, am I lost...LMAO. 🤣🤣🤣

Ответить
Crazy Clown
Crazy Clown - 30.08.2022 05:29

No no no no

Ответить
kasten
kasten - 10.08.2022 19:23

Bro, I watched several tutorials but no one dived into args and kward before at this point except you. This channel should be saved at any price

Ответить
ABC
ABC - 06.08.2022 01:19

You explain much more detail than Mike's video, I have so many question after I watched his video.

Ответить
SealSore65
SealSore65 - 01.08.2022 19:02

slow down chief

Ответить
-Camm
-Camm - 31.07.2022 23:41

im pretty sure def = define because you're defining a function

Ответить
The Learner
The Learner - 15.07.2022 20:43

just finished this 20 min lecture in 1 hour , your each word contains so many information that is way beyond the expectations ,
Thanks a lot Sir for teaching function

Ответить
OĞUZ TÜRKYILMAZ
OĞUZ TÜRKYILMAZ - 12.07.2022 22:16

Thanks

Ответить
Matt Tube
Matt Tube - 10.07.2022 01:31

One of the best explanations Ive seen so far easily

Ответить
Joey Zalman
Joey Zalman - 04.07.2022 15:56

very clear. thank you very much

Ответить
YouAre MAD
YouAre MAD - 20.05.2022 09:27

Honestly the way those of statements are set up gets me confused

Ответить
Dave 24-7
Dave 24-7 - 17.05.2022 11:32

Hi Corey, I’m learning Python and my lecture has a habit of making simple things hard, I’ve watched two of your videos and been able to get up to date, and you have managed to give me more depth and detail in 30 minutes where as I have had 2 hour classes and come out confused. Keep the videos coming they are a real benefit to people new to Python.

Ответить
riteshrohilla440
riteshrohilla440 - 11.05.2022 10:44

# Number of days per month. First value placeholder for indexing purposes.
month_days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def is_leap(year):
# Return True for leap years, Flase for non-leap years.
return year % 4 == 0 and (year % 100 !=0 or year % 400 == 0)

def days_in_month(year, month):
# Return number of days in that month in that year.
if not 1 <= month <= 12:
return 'Invalid month'

if month == 2 and is_leap(year):
return 29

return month_days[month]

Ответить
Алексей Соков
Алексей Соков - 01.05.2022 11:39

2022

Ответить
91dgross
91dgross - 29.04.2022 03:05

You said that parameters are local don’t effect anything outside of the function. That’s incorrect sir. If you pass a list to a function and make changes to it within the function it will also effect the list that was originally passed. Decent video 6.5/10. You jumped into some advanced stuff without covering the basics

Ответить
Fábio Lima
Fábio Lima - 23.04.2022 11:04

wow!!!😯 Man, your explanation is really above the average.

Ответить
Paul M
Paul M - 20.04.2022 18:18

solved it :)
def hello_func():
print('Hello Function')

x = 0
while x < 4:
hello_func()
x += 1

Ответить
Paul M
Paul M - 20.04.2022 18:12

Hello Corey, Yes, you are a born teacher. Indeed your explanation is thorough and very very clear. I have one question about that function that you call four times. Is it possible to call that function four times in a loop?

Ответить
NEWS JUICE
NEWS JUICE - 12.04.2022 07:54

Corey is GOAT 🐐 can’t thank you enough for such an amazing content please comeback to upload new content

Ответить