Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Python Fundamentals

Lesson 10 of 55 · Python

Arguments and Return Values

Duration: 20 minutes

Arguments and Return Values\n\nFunctions can accept positional, keyword, default, and variable‑length arguments.\n\npython\ndef repeat(message, times=2):\n return message * times\n\nprint(repeat('Hi')) # HiHi\nprint(repeat('Hi', 3)) # HiHiHi\n\n\n- Positional arguments are matched by order.\n- Keyword arguments let you specify the parameter name (repeat(message='Hi', times=3)).\n- Default values (times=2) make an argument optional.\n- Use *args to collect extra positional arguments and **kwargs for extra keyword arguments.\n

Previous: FunctionsNext: Lambda Functions