filmov
tv
Python for non-programmers, lesson 12: Functions

Показать описание
Learn how to define and use functions in Python — a key building block for writing better, more reusable code.
Want to teach the computer to do something new? You want to define a function. Not surprisingly defining functions is one of the most common things that programmers do. In this video, I introduce the idea of functions, how to define them, how to invoke them, and how to get results ("return values") back from them.
-----
Homework exercises for this lesson:
1. Write a function, maxnum, that takes a single argument, a list of numbers. It returns the largest number in that list. (Do not use the built-in max function to do this!)
2. Write a function, lastword, that takes a list of words. It returns the word in that list that occurs last, alphabetically.
3. Write a function, charcount, that takes a string and returns a dict. The dict’s keys will be all of the different characters that occur in the string, and its values will be the number of times that each character appeared.
Want to teach the computer to do something new? You want to define a function. Not surprisingly defining functions is one of the most common things that programmers do. In this video, I introduce the idea of functions, how to define them, how to invoke them, and how to get results ("return values") back from them.
-----
Homework exercises for this lesson:
1. Write a function, maxnum, that takes a single argument, a list of numbers. It returns the largest number in that list. (Do not use the built-in max function to do this!)
2. Write a function, lastword, that takes a list of words. It returns the word in that list that occurs last, alphabetically.
3. Write a function, charcount, that takes a string and returns a dict. The dict’s keys will be all of the different characters that occur in the string, and its values will be the number of times that each character appeared.
Python for non-programmers, lesson 12: Functions
Python for Beginners - Learn Coding with Python in 1 Hour
Learn Python for FREE in 2025
Python Basics: Your FIRST Program in Under a Minute! 🚀
Python Programming Lesson 12 – Global and Local Variables | Python 3 For Beginners
Stop learning Python👀
Python for Beginners – Full Course [Programming Tutorial]
Python Roadmap for Beginners! 🐍 Learn Python Programming Step-by-Step' #python #conding
From Zero to AI Agent: Vibe Coding with Cursor & PydanticAI
It’s literally perfect 🫠 #coding #java #programmer #computer #python
Coding for 1 Month Versus 1 Year #shorts #coding
LIST IN PYTHON LESSON 12 | CODING AND PROGRAMMING TAGALOG TUTORIALS
Functions in Python are easy 📞
Python courses for Beginners (FREE)
I learned python so I can do this...
Python LAMBDA FUNCTION?! #python #programming #coding
What programming language you should learn👩💻(based off your interests) #programming #technology...
Learn Programming with Python - Lesson 12
Python Basics: The Best Way to Learn Python Programming (2024)
How to Run Python Programs ( .py Files ) on Windows 11 Computer #learnpython #pythonlearning
Python Full Course for Beginners
Python Tutorial 12: Simple Python Sorting Program
Subscribe for more coding tips🔥#trending #python #coding #aitools #java #program
Python Full Course for free 🐍 (2024)
Комментарии