# Python Functions || Python Tutorial || Learn Python Programming

///Python Functions || Python Tutorial || Learn Python Programming

## Python Functions || Python Tutorial || Learn Python Programming

Functions are essential to Python programming. In this tutorial, we teach you how to create a function, and cover the two types of arguments: required arguments and keyword arguments.

To learn Python, start our Python Playlist HERE:

Subscribe to Socratica:

♦♦♦♦♦♦♦♦♦♦

We recommend:
Python Cookbook, Third edition from O’Reilly

The Mythical Man Month – Essays on Software Engineering & Project Management

Shop Amazon Used Textbooks – Save up to 90%

♦♦♦♦♦♦♦♦♦♦

Ways to support our channel:

► Make a one-time PayPal donation:
► We also accept Bitcoin @ 1EttYyGwJmpy9bLY2UcmEqMJuBfaZ1HdG9

Thank you!

♦♦♦♦♦♦♦♦♦♦

Connect with us!

Instagram:

♦♦♦♦♦♦♦♦♦♦

Python instructor: Ulka Simone Mohanty
Written & Produced by Michael Harrison
FX by Andriy Kostyuk

♦♦♦♦♦♦♦♦♦♦

source

By |2021-08-03T15:28:18+00:00August 3rd, 2021|Python Video Tutorials|38 Comments

1. Socratica August 3, 2021 at 3:28 pm - Reply

Welcome to Socratica! You can see our entire Python Playlist here: http://bit.ly/PythonSocratica

Subscribe to see all our new videos! http://bit.ly/SocraticaSubscribe

2. Chisom Ezeike August 3, 2021 at 3:28 pm - Reply

def prime_number(num):

int_= [2,3,4,5]

prime = [1,2,3,5]

for p in prime:

if num == p :

return print(p, 'is a prime number')

for i in int_:

if num % i == 0:

return print(num, 'is not prime number')

else:

return print (num, 'is a prime number').

please i tried creating a function that could bring out prime numbers with this code. all numbers ran smoothly except 27,9 and 21. according to the code they were prime numbers.
can someone please explain to me where i got it wrong

but when i did this below everything worked fine

def prime_number(num):
int_= list(range(2,6))
prime = [1,2,3,5]
for p in prime:
if num == p :
return print(p, 'is a prime number')
for i in int_:
if num % i == 0:
return print(num, 'is not prime number')
return print (num, 'is a prime number')

3. VanityConcubine August 3, 2021 at 3:28 pm - Reply

Okay, I failed math, so I'm pretty much shit out of luck…

4. youssef amen August 3, 2021 at 3:28 pm - Reply

I love ur way of teaching keep going

5. Anthony Hairston August 3, 2021 at 3:28 pm - Reply

# This is the dictionry
pips = {"Tie":1, "Noah":2, "Ma":3, "rye":4, "Law":5, "shoe":6, "Cow":7, "ivy":8, "Bee":9, "Toe":10}
# Request the user pick a number to the associated Key
Peg = input(“ pick a number from 1-10 ” + pips [ ])
Print(“This is your associated key ” + peg)
#How do you get the associated user input to the dictionry?

6. a77a August 3, 2021 at 3:28 pm - Reply

Love, love and love this instructor's style and theatrics. Her voice is perfectly tuned with her presentation, these things together makes the tutorials memorable and you'll find yourself learning as you enjoy the innuendos and double entendre. "Deja vu"!

7. Chomnan Saedan August 3, 2021 at 3:28 pm - Reply

These types of tutorials are officially, to me, the gold standard of computer science teaching, its just so clean and interesting.

8. Alex K August 3, 2021 at 3:28 pm - Reply

Why does the interpreter automatically know the v is the volume at 4:35? I was kinda thinking that there would be a point where you assign v to volume.

9. samter August 3, 2021 at 3:28 pm - Reply

I suppose if you forget and put keyword arguments first, then default is yours…

10. Parzehlli Tv August 3, 2021 at 3:28 pm - Reply

I think I might of finally found an enjoyable way to learn python? Very helpful but not very useful I think I might of finally found an enjoyable online instructor to learn python? Useful and helpful adding in the Deja vu! Cool.

11. Jan Meww's August 3, 2021 at 3:28 pm - Reply

what happened to the new Python video tutorials as promised?

12. Just Gaming August 3, 2021 at 3:28 pm - Reply

Isnt the thing you referred to as an argument the whole time a parameter and in the function like when you type it to recall it inside THOSE parenthesis is/are the argument(s)?

13. Joseph Cote August 3, 2021 at 3:28 pm - Reply

Sometimes I will use a function that is only called from one place. A couple of reasons I might do this. It might extract a lump of complicated code out of the main flow of a program; a function called calculate_surcharge() is just as good at that point as seeing all the messy code that goes into it. Which leads to the other main reason for single-use fuctions: collecting a bit of possibly messy code into one place. This makes it easier to find and modify.

And by messy here I do not mean bad code, but perhaps very complicated. For a real life example, I programmed for a worker's comp insurance company. The rate we charged for each type of job changed year to year. We might have to recalculate a bill from any previous year, so it was a lot of data lookup and date comparisons to find the right rate for a given job code and billing date. A great thing to lump together in a function, even if you only need it at one place in the program.

14. Samuel August 3, 2021 at 3:28 pm - Reply

I like the way she talks like a robbot

15. AC0077 August 3, 2021 at 3:28 pm - Reply

Wooohooooooo! Love this series!!!!!

16. Ashley keymond August 3, 2021 at 3:28 pm - Reply

I'm lost, what is python?

17. immortalxRob August 3, 2021 at 3:28 pm - Reply

Thank you, A.I lady!

18. Jean Brethous August 3, 2021 at 3:28 pm - Reply

You are brilliant. Fantastic way to teach: with class and wit.

19. Amin Nor August 3, 2021 at 3:28 pm - Reply

???????☘☘???

20. 53 Strat August 3, 2021 at 3:28 pm - Reply

I love how you formulate your sentences and the general vibe of the tutorial overall. Subscribed

21. Clarion Isige August 3, 2021 at 3:28 pm - Reply

Great Lesson Socratica

22. Joseph Cohen August 3, 2021 at 3:28 pm - Reply

Holy shit I love this person. Awesome style. To show my enthusiasm, I will subscribe.

23. Li Ken August 3, 2021 at 3:28 pm - Reply

Best python tutorial on Youtube!

24. davis thomas August 3, 2021 at 3:28 pm - Reply

Beautifully explained and engaging! Humor in the spirit of Python!

25. Mr. B August 3, 2021 at 3:28 pm - Reply

No one wants those accusing glares..

26. yee ya August 3, 2021 at 3:28 pm - Reply

this is so engaging

27. Diego Languages August 3, 2021 at 3:28 pm - Reply

In Python 3 you may not specify the second argument. You can call the function g as g(7,3) and the result will be 10.

28. Sanket Thakre August 3, 2021 at 3:28 pm - Reply

after half time there start geometry lecture

29. Alex Simon August 3, 2021 at 3:28 pm - Reply

Thanks for the video

John 3;35" The Father loveth the Son, and hath given all things into his hand.

36 He that believeth on the Son(Jesus Christ) hath everlasting life: and he that believeth not the Son shall not see life; but the wrath of God abideth on him."

Jesus Christ is real. if you don't keep his commandments the wrath of God abideth on you(which will be forever in hell)

Repent and turn your life to Christ before Judgment day comes.

Many people will disagree and mock you trust me, but its worth it for an eternity praising our Creator. As Jesus said "if they hate you remember they first hated me"(John 15:18). Read the bible, start from the New testament. God bless you. Jesus answered and said unto him, Verily, verily, I say unto thee, Except a man be born again, he cannot see the kingdom of God.(Joh.3:3)How to be born again? You can not(like how you wasn't physically born by your own will) by your own will, but what you can do is ask God (Mat 7:7 for the rest..)

30. Kh Saqlain August 3, 2021 at 3:28 pm - Reply

according to my understanding def f(): inside the parentheses are called parameters and when we call the function we will pass arguments.

31. Shadow Runner August 3, 2021 at 3:28 pm - Reply

I'm extremely new to programming, learning python, sorry guys i'm 45 years old, hope someone can answer this question for me, I am learning through pycharm, feel more comfortable with it. I love these this tutorial it's answering a lot of questions for me, my question is this, my code doing it this way seems to work great, with no errors, but the problem is why can't I see it printed up in my terminal ?

32. Fariz Darari August 3, 2021 at 3:28 pm - Reply

You got me at deja vu 😀

33. Mickey Saine August 3, 2021 at 3:28 pm - Reply

This stuff is amazing! Spent two hours of frustration in a text-book on a chapter, trying to understand this. Watched 9 mins video…Got it all and then some!

Super glad to see this!

34. Dass e August 3, 2021 at 3:28 pm - Reply

I end comments with enthusiasm !

35. Nirupa Naidu August 3, 2021 at 3:28 pm - Reply

???

36. Piotr Kulinski August 3, 2021 at 3:28 pm - Reply

Great tutorials! 5 years later still extremely useful.

37. M Alam August 3, 2021 at 3:28 pm - Reply

I like like it. very socratica

38. Shrinandan Sharma August 3, 2021 at 3:28 pm - Reply

Tagdri editing