Back to Browse

Python for Neuroimagers, Part 4: Functions and Modules

372 views
Jun 11, 2025
7:01

Functions are blocks of code that perform a specific action, or return a value depending on their input. In this video you will learn the fundamentals of functions, including how to use them, and how to create your own. We will end with modules, which are packages that can contain several different functions, and how to import individual functions from the modules. Link to chapter 4 of the Python for Neuroimagers tutorial of Andy's Brain Book: https://andysbrainbook.readthedocs.io/en/latest/PythonForNeuroimagers/Python_04_Functions_Modules.html ----------------- Code used: pow(10,2) help(pow) pow(exp=2, base=10) def my_power_function(base, exp): """This function requires a base number and an exponent. The base will be raised to the power of the exponent Example: my_power_function(10,2) """ return base**exp import random random.randint(1,10) from random import randint import random as rand from random import randint as ri ri(1,10) ----------------- Table of Contents ============== 0:00 What is a function? 1:00 Help files of functions 2:06 Creating your own function 4:01 Accessing all of the built-in functions from Python's library 4:50 Importing modules 5:35 Using aliases 6:33 Summary

Download

0 formats

No download links available.

Python for Neuroimagers, Part 4: Functions and Modules | NatokHD