Defining a Factorial Function

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
16,709
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jun 29, 2011

Defining a function in Python

Category:

Education

Tags:

Download this video

LICENSE: Creative Commons (Attribution-Noncommercial-No Derivative Works).

For more information about this license, please read: http://creativecommons.org/licenses/by-nc-nd/3.0/.

High-quality MP4 Learn more

  • likes, 0 dislikes

Link to this comment:

Share to:

Top Comments

  • Though it is arguably less clear, you can put the last part of what Sal did in one line:

    print(factorial(input("Enter a non-negative integer to take the factorial of:")))

    Just remember that the inner-most function runs first, and the next function takes what the last one returned as its argument.

  • khan, what can't you do ? :)

see all

All Comments (16)

Sign In or Sign Up now to post a comment!
  • I love that you are doing this in python. While i don't use python myself i've been thinking about adding it as a script language, in my projects. So it's always nice to get a clear straightforward explanation about the language by my favorite teacher.

  • Can't find the whole computer science playlist on the khan academy website. where is it on the website?

  • OMFG FINALLY COMPUTER SCIENCE PLAYLIST!

  • @cilution this is more advance Sal is making it more robust so people understand better, but he forgot to mention what you said in your comment.

  • Hey Sal, the New Boston already does these tutorials. No need to waste your time teaching us programming when there's already someone who does it well.

  • @xxPwnedProductionsxx Who the fuck cares.

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more