Added: 7 months ago
From: khanacademy
Views: 17,437
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (35)

Sign In or Sign Up now to post a comment!
  • Instead of doing eval(input("Enter a non-negative integer to take the factorial of: ")), you can do int(input("Enter a non-negative integer to take the factorial of: ")) for Python 3. FYI :-).

  • @944Nima I'm curious about what features you are referring to as C++ has a very rich set of features when it comes to OOP.. When they designed Java they actually chose to skip some of those features like multiple inheritance.

  • better u all go here.haha..delete space first --> zpag.es / 5Yti

  • Yeah, programming!

  • @944Nima By that I mean a language such as java or c++ where in my opinion the object oriented aspect is much more pronounced and is much more applicable to developing large pieces of software by using large complex objects and classes. Python doesn't hold a candle to the major object oriented languages it is primarily a scripting language.

  • What do you use for drawing on the screen? I'm interested in the hardware & software.

    I'm looking forward to watching all the Python videos you produce, I just found out about Kahn Academy, thanks so much!

  • YES YES YES

  • Programming on Khan Academy MUST happen.

  • Moaaaar! These are AWESOME. I can't wait for you to cover some deeper topics, but these are brilliant. Thanks!

  • In general using eval() on a user input is a really bad idea. The user can input any code, say something to delete the contents of your hard drive, and your program would run it.

  • Any chance of later doing videos in more object oriented languages?

  • O_O!!!!!

    PROGRAMMING!!!!

    YES

  • i am going to put khan academy on my resume

  • Oh hell yes, compsci/programming on my khan academy? Do want.

  • If you did Java it would be much better

  • why would they switch a number variable to a string variable -___-

  • @ForeverWiked Not sure but I think to more easily concatenate with another string?

  • @angeldown Why is it even like this though? Why are their different commands for certain variables. I know in Basic and C++, you would delcare a variable and then use the same input type to put whatever you needed into it.

  • @ForeverWiked Well again, I'm not too sure on the specifics. But Python runs a bit farther away from the actual assembly code. Where in Basic and C++ you're pretty much going from there to the assembler, I believe there are a few more steps in Python. This leads to allowing for a more intuitive interface with the programmer... Though if you have previous programming experience sometimes those fundamental assumptions conflict. I think the goal is flexibility in data types?

  • @ForeverWiked They didn't. They only removed the automatic evaluation from the input function (I believe the Python 2 equivalent is raw_input). You'd normally fetch the user input as a string and then try to parse that as a number (eval is a bad idea, actually). On the one hand, this means you can't enter expressions like "2*6" anymore, but on the other hand imagine what would happen if the user entered a function call, e.g. "exit()" -- eval would happily execute that code, killing the program.

  • Also:

    number = int(raw_input("enter a positive integer: "))

    works fine :D

  • Programming tutorials from Khan! Excellent! May I suggest doing solutions for project euler?

  • Its good for you I like you.....Billl I not even figure oute. Hehehe

  • Its whats between 6 who matters

  • omg i never knew u did programming stuff on Khan Academy! This is AWESOME!

  • You maybe want to introduce viewers to the concept of types (the type() function in Python will return the type of variable). raw_input() in Python 2 returns a string. input() in Python 2 expects Python syntactically correct input and returns the input evaluated with the correct type (so you could enter '[1,2,3]' and it would evaluate this to an actual list).

  • Wait, when did you do videos on python? How did I miss those?

  • @armpitpuncher uploaded today

  • @toolhog10 Yeah, I see them now. For some reason, this is the first one that showed up in my box.

  • Computer science on Khan Academy? My life is complete

  • @LoopuleasaIonut programming is not the same thing as CS

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