Python - CS50 Shorts

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ธ.ค. 2024
  • ***
    This is CS50, Harvard University's introduction to the intellectual enterprises of computer science and the art of programming.
    ***
    HOW TO SUBSCRIBE
    www.youtube.com...
    HOW TO TAKE CS50
    edX: cs50.edx.org/
    Harvard Extension School: cs50.harvard.e...
    Harvard Summer School: cs50.harvard.e...
    OpenCourseWare: cs50.harvard.e...
    HOW TO JOIN CS50 COMMUNITIES
    Discord: / discord
    Ed: cs50.harvard.e...
    Facebook Group: / cs50
    Faceboook Page: / cs50
    GitHub: github.com/cs50
    Gitter: gitter.im/cs50/x
    Instagram: / cs50
    LinkedIn Group: / 7437240
    LinkedIn Page: / cs50
    Reddit: / cs50
    Quora: www.quora.com/...
    Slack: cs50.edx.org/s...
    Snapchat: / cs50
    Twitter: / cs50
    TH-cam: / cs50
    HOW TO FOLLOW DAVID J. MALAN
    Facebook: / dmalan
    GitHub: github.com/dmalan
    Instagram: / davidjmalan
    LinkedIn: / malan
    Quora: www.quora.com/...
    Twitter: / davidjmalan
    ***
    CS50 SHOP
    cs50.harvardsh...
    ***
    LICENSE
    CC BY-NC-SA 4.0
    Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
    creativecommon...
    David J. Malan
    cs.harvard.edu...
    malan@harvard.edu

ความคิดเห็น • 83

  • @chrisoaus5328
    @chrisoaus5328 4 ปีที่แล้ว +435

    Python Syntax Overview - 2:16
    Variables - 2:44
    Conditionals - 4:14
    Loops - 7:50
    Arrays/Lists - 10:19
    Tuples - 14:44
    Dictionaries - 18:46
    Printing and Variable Interpolation - 24:25
    Functions - 25:20
    Objects - 27:37
    Style - 35:15
    Including Files - 36:28

    • @xrafter
      @xrafter 4 ปีที่แล้ว +1

      I thought it called importing?

    • @gasparzuker
      @gasparzuker 4 ปีที่แล้ว

  • @robotnixon3453
    @robotnixon3453 4 ปีที่แล้ว +135

    Doug is such an oddly charismatic guy.

  • @andyalberts6621
    @andyalberts6621 ปีที่แล้ว +17

    I always look forward to Dougie Fresh's shorts vids. David is a raging madman, slinging information at top speed. Dougie pulls it all in and makes it more digestible (No shade to David, the whole team is a great combo)

  • @joseville
    @joseville 4 ปีที่แล้ว +70

    Update to code at 16:53: now you can use f-strings too:
    print(f"In {year}, {prez} took office.")

    • @reedcolloton4893
      @reedcolloton4893 3 ปีที่แล้ว +10

      they really should update it- the lecture uses f-strings too

    • @vinayjangra1401
      @vinayjangra1401 3 ปีที่แล้ว

      Yessssssssssss

    • @ritaahmed989
      @ritaahmed989 ปีที่แล้ว

      thank you! very helpful

  • @nervous711
    @nervous711 3 ปีที่แล้ว +79

    It's somehow uncomfortable when seeing variable type not initialised......

    • @coldfire6869
      @coldfire6869 ปีที่แล้ว +3

      It'll take some time for me to get used to it. Feels really strange.

    • @scaramouche7759
      @scaramouche7759 ปีที่แล้ว +4

      Yea it just felt normal telling the computer, like hey I need a variable of this type, so use up 32-bits. Now it’s kind of like, talking to computer in incomplete sentences lol.

  • @rautermann
    @rautermann 4 ปีที่แล้ว +63

    2019 UPDATE: Dictionaries entries stay in the order you created them - in CURRENT VERSIONS of Python (3.7 and above)!
    And for all of us who got so used to explicitly declaring variable and return types: It's worth mentioning that using types explicitly is possible now in Python (through special syntax) and I feel it's becoming more common at the moment! It is totally optional, but it can be useful to avoid errors from wrong types!

    • @danivanon
      @danivanon 2 ปีที่แล้ว

      Doug lost the order at @22.18, when he wasn't even using the .items() method, which is weird.

    • @yash1152
      @yash1152 ปีที่แล้ว

      thanks for sharing explicit type declaration in python. yes, i am an admiror of properly typed code.

    • @Triskelion345
      @Triskelion345 ปีที่แล้ว

      holly hell

  • @bluebird563
    @bluebird563 6 ปีที่แล้ว +39

    best python crash course on youtube

  • @pyb.5672
    @pyb.5672 6 ปีที่แล้ว +34

    Hi, just a quick note on the fact that using "id" as a parameter variable in the object is not ideal as id() is actually a built in function in Python. Using "id_" or "iden" or whatever will resolve the issue that most students will encounter when trying to print jane.id.

  • @dennistravelriffs
    @dennistravelriffs 4 ปีที่แล้ว +264

    "Shorts"

    • @TheRamstoss
      @TheRamstoss 4 ปีที่แล้ว +17

      He is still the shorts guy

    • @hellothere2407
      @hellothere2407 4 ปีที่แล้ว +20

      I'd hate to see the longs :')

    • @FrankoAli
      @FrankoAli 4 ปีที่แล้ว +2

      😂😂👌

  • @SeyidAr
    @SeyidAr ปีที่แล้ว +20

    For some reason i like C more than Python. I really enjoyed the first 5 weeks actually.

    • @phonixMAM
      @phonixMAM 9 หลายเดือนก่อน +13

      stockholm syndrome

    • @luizashabetnick8059
      @luizashabetnick8059 2 หลายเดือนก่อน +1

      ​@@phonixMAMLMAO

  • @b3an5j28
    @b3an5j28 4 หลายเดือนก่อน +1

    22:55 Should be updated that Python 3.7 onwards dicts will preserve insert order. Maybe write it on the video's description, because it could potentially confuse future students.

  • @sungvin
    @sungvin 2 ปีที่แล้ว +1

    That explanation with __init__ has finally cleared all of my previous questions, such a nice entry to the OOP

  • @arunkumaralagarsamy716
    @arunkumaralagarsamy716 4 ปีที่แล้ว +4

    this syntax is simple for 16:58 print(f"In {year}, {pres} took office")

  • @utilizator500
    @utilizator500 3 ปีที่แล้ว +6

    This really needs to be updated

  • @qixiangwong5849
    @qixiangwong5849 4 ปีที่แล้ว +12

    Like most of your intro videos, except the OOP explanation in this one. If someone doesn't know OOP from other language, your explanation in this one probably just exploded their heads

  • @DogginsFroggins
    @DogginsFroggins 2 ปีที่แล้ว +3

    Pythons greatest asset is its coolness
    C - a literal letter, lame
    Java - Coffee is boring
    Java Script - Cooler because script sounds leet
    Assembly - Reminds me of highschool.
    Python - An actual snake
    Python is the winner

  • @이이이-g4f2y
    @이이이-g4f2y 6 หลายเดือนก่อน +1

    This 39-minute video, one of the most useful "shorts" in the world, calls itself a "shorts"

  • @mon0theist_tv
    @mon0theist_tv 2 ปีที่แล้ว +7

    16:19 how does the code/computer/interpreter/whatever know what "prez" and "year" is? How does it know to correspond to the tuple values?

    • @ElTopDev
      @ElTopDev ปีที่แล้ว +3

      I guess by this moment you should know it (5 months later hehehe) but yeah, for other ppl who may be wondering. It's because of the order of the parameters in the for in declaration: for prez, year in presidents.values()

    • @johnnyklash5883
      @johnnyklash5883 ปีที่แล้ว +3

      @@ElTopDev Thank you so much for that, I came to youtube comments for that reason.

  • @femtoapple
    @femtoapple 4 ปีที่แล้ว +6

    perfect python crash course. thanks Doug!

  • @gamingbeasts7480
    @gamingbeasts7480 6 ปีที่แล้ว +8

    Doug you are awesome...incredibly awesome..

  • @albertcedeno
    @albertcedeno 7 ปีที่แล้ว +40

    Teach me how to "dougie."

  • @Renan-g9n
    @Renan-g9n 7 หลายเดือนก่อน +2

    The tuples section is a little outdated

  • @fatadel
    @fatadel 6 ปีที่แล้ว +9

    14:05
    nums[len(nums):] = [5]
    Could anyone tell why the hell there is that colon after len(nums)?

    • @hugochiang6395
      @hugochiang6395 5 ปีที่แล้ว +19

      It means from len(nums) onward

  • @vinayjangra1401
    @vinayjangra1401 3 ปีที่แล้ว +1

    Thanks Doug Lloyd Sir🙏🙏❤️

  • @scaramouche7759
    @scaramouche7759 ปีที่แล้ว +1

    Python looks like a paragraph that is missing periods between sentences at first glance lol. I got used to brackets and curly braces.

  • @edprins1760
    @edprins1760 3 ปีที่แล้ว +1

    I do not like the example withe the bool assignment. In C you would write: bool alphabetic = ( isalpha(var)); for the example bette choose a non boolean assignment.

  • @MoolsDogTwoOfficial
    @MoolsDogTwoOfficial 8 หลายเดือนก่อน

    Since I coded a lot in Python since 2019 to 2023, this week will be a breeze.

  • @rickydonne802
    @rickydonne802 4 ปีที่แล้ว +3

    So by the time the video was recorded, Python was at 5th-6th but now it is at number 1. This shows how the world is getting close to more AI and data science. Now it's just a matter of time that C will become an advanced/Intermediate course instead of a beginner's. Python is more attractive and more forgiving. So I guess schools and everywhere people will be taught Python to get large number of people into programming.

    • @mon0theist_tv
      @mon0theist_tv 2 ปีที่แล้ว +10

      Idk I kinda like that CS50 teaches C first, so you can see the lower-level way of doing things first, and then appreciate the ease of higher level languages

  • @tjanderseon7838
    @tjanderseon7838 4 ปีที่แล้ว +5

    26:37 is that code in the bottom right hand corner of the slide still necessary?
    all I have is def main(): at the top and main() at the bottom and I can use functions in any order

    • @IchiroSakamoto
      @IchiroSakamoto 4 ปีที่แล้ว +9

      The line means if the python file is run directly, main() executes. If the file is imported into another file then main() doesn’t execute

    • @joseignacioyanez572
      @joseignacioyanez572 4 ปีที่แล้ว

      @@IchiroSakamoto thanks

  • @dim4atij
    @dim4atij 4 ปีที่แล้ว +3

    I thought the dictionary in Python3 is ordered - am I wrong? E.g., if it's defined as "cheese" then "pepperoni" then it will iterate in the same order.

    • @madwatcher1
      @madwatcher1 4 ปีที่แล้ว +4

      It is guaranteed only in python 3.7+. So you're right and he was right too

  • @bawwwdis232
    @bawwwdis232 4 ปีที่แล้ว +2

    Dude was on jeopardy

  • @solarenergynow08
    @solarenergynow08 4 ปีที่แล้ว +1

    Are these slides available ?

  • @trovr
    @trovr 4 ปีที่แล้ว +3

    in this part - 20:46
    is this " if pizza["vegetables"] < 12 " wrong? isnt this way: "if pizzas[... " ?

    • @trovr
      @trovr 4 ปีที่แล้ว

      @irina lyrics thanks! :)

    • @tristanJollyz
      @tristanJollyz 5 หลายเดือนก่อน

      @@trovr i'm wonder why too, can you explain, seems like the other guy has deleted his comment

  • @yechen5615
    @yechen5615 4 ปีที่แล้ว +2

    May I know why
    result = 0
    for i in range(0, x):
    result += x
    return result
    print(square(5))
    will come out 25? shouldn't it be 0+5+1+5+2+5+3+5+4+5? for loops is always my pain.

    • @CH3LS3A
      @CH3LS3A 4 ปีที่แล้ว +7

      the for loop will iterate from the starting value (which you've set as 0) to the end value, which you've set as x. but in your code, you're just adding x to result, and you're not adding the for loop's iterator (the variable i). your for loop just adds 5 + result, 5 times, since that's the range dictated by range(0, x).
      if you want 0+5+1+5+2+5+3+5+4+5, try:
      for i in range(0, x):
      result += x
      result += i
      return result + 5

    • @yechen5615
      @yechen5615 4 ปีที่แล้ว

      @@CH3LS3A Thank you very much. Now I got it.

  • @ZakariaShahen
    @ZakariaShahen 3 ปีที่แล้ว

    17:37
    Error:
    n[len(n):] = 4
    TypeError: can only assign an iterable

    • @merorus6680
      @merorus6680 3 ปีที่แล้ว +3

      You shold put braces around 4

  • @getsunova8894
    @getsunova8894 2 ปีที่แล้ว +1

    So.. is Tuples pronounced as too-ple or tup-ple.

  • @Lucky7th7450
    @Lucky7th7450 10 หลายเดือนก่อน +2

    40 short minutes.

  • @patrickmcauliffe7162
    @patrickmcauliffe7162 4 ปีที่แล้ว +1

    you are the best doug!

  • @ghostfjdgcsusvsgsj
    @ghostfjdgcsusvsgsj 3 ปีที่แล้ว

    Thank you Doug

  • @itspurelypassionate
    @itspurelypassionate 4 ปีที่แล้ว

    Are python classes supposed to be on different page/file like java?

  • @jerrys.lawson5418
    @jerrys.lawson5418 4 ปีที่แล้ว +1

    Thank you Doug ~ everything lol

  • @chandrakantjena3431
    @chandrakantjena3431 4 ปีที่แล้ว

    new thing about shell scripting - 37:55

  • @jeetshah8513
    @jeetshah8513 4 ปีที่แล้ว +1

    Can I use selenium module???

  • @shahidulislamzahid5172
    @shahidulislamzahid5172 2 ปีที่แล้ว

    thank you so much

  • @joshuagarber662
    @joshuagarber662 6 หลายเดือนก่อน

    27:37 haha i see what you did there! 😜

  • @alialparslan2288
    @alialparslan2288 3 ปีที่แล้ว

    25:30 aahhah Ditto

  • @BoBo-yn4xf
    @BoBo-yn4xf 3 ปีที่แล้ว

    Dec 7, 2021

  • @BadalKumar-tu2wg
    @BadalKumar-tu2wg 3 ปีที่แล้ว

    Good sir

  • @devmoldogazy
    @devmoldogazy 4 ปีที่แล้ว +1

    Python 😍👍🏻👍🏻
    How can I learn PYTHON easily, quickly and successfully? Can you tell me if you can?

    • @ns8928
      @ns8928 4 ปีที่แล้ว +1

      Practice, Practice and Practice. Keep learning new things.

    • @armstrongtixid6873
      @armstrongtixid6873 4 ปีที่แล้ว +1

      @@ns8928 Go to freeCodeCamp.org and search for their Python course for beginners by Mike Dane (Giraffe Academy). It's perfect.

  • @chrislam1341
    @chrislam1341 4 ปีที่แล้ว +2

    shebang 37:55

  • @albertcedeno
    @albertcedeno 7 ปีที่แล้ว +4

    2nd

  • @talhatariqyuluqatdis
    @talhatariqyuluqatdis 7 ปีที่แล้ว +4

    1st

  • @albertcedeno
    @albertcedeno 7 ปีที่แล้ว +4

    4th

  • @albertcedeno
    @albertcedeno 7 ปีที่แล้ว +4

    3rd