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
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
I thought it called importing?
Doug is such an oddly charismatic guy.
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)
Update to code at 16:53: now you can use f-strings too:
print(f"In {year}, {prez} took office.")
they really should update it- the lecture uses f-strings too
Yessssssssssss
thank you! very helpful
It's somehow uncomfortable when seeing variable type not initialised......
It'll take some time for me to get used to it. Feels really strange.
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.
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!
Doug lost the order at @22.18, when he wasn't even using the .items() method, which is weird.
thanks for sharing explicit type declaration in python. yes, i am an admiror of properly typed code.
holly hell
best python crash course on youtube
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.
"Shorts"
He is still the shorts guy
I'd hate to see the longs :')
😂😂👌
For some reason i like C more than Python. I really enjoyed the first 5 weeks actually.
stockholm syndrome
@@phonixMAMLMAO
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.
That explanation with __init__ has finally cleared all of my previous questions, such a nice entry to the OOP
this syntax is simple for 16:58 print(f"In {year}, {pres} took office")
This really needs to be updated
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
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
This 39-minute video, one of the most useful "shorts" in the world, calls itself a "shorts"
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?
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()
@@ElTopDev Thank you so much for that, I came to youtube comments for that reason.
perfect python crash course. thanks Doug!
Doug you are awesome...incredibly awesome..
Teach me how to "dougie."
The tuples section is a little outdated
14:05
nums[len(nums):] = [5]
Could anyone tell why the hell there is that colon after len(nums)?
It means from len(nums) onward
Thanks Doug Lloyd Sir🙏🙏❤️
Python looks like a paragraph that is missing periods between sentences at first glance lol. I got used to brackets and curly braces.
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.
Since I coded a lot in Python since 2019 to 2023, this week will be a breeze.
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.
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
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
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
@@IchiroSakamoto thanks
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.
It is guaranteed only in python 3.7+. So you're right and he was right too
Dude was on jeopardy
Are these slides available ?
in this part - 20:46
is this " if pizza["vegetables"] < 12 " wrong? isnt this way: "if pizzas[... " ?
@irina lyrics thanks! :)
@@trovr i'm wonder why too, can you explain, seems like the other guy has deleted his comment
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.
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
@@CH3LS3A Thank you very much. Now I got it.
17:37
Error:
n[len(n):] = 4
TypeError: can only assign an iterable
You shold put braces around 4
So.. is Tuples pronounced as too-ple or tup-ple.
40 short minutes.
you are the best doug!
Thank you Doug
Are python classes supposed to be on different page/file like java?
Thank you Doug ~ everything lol
new thing about shell scripting - 37:55
Can I use selenium module???
thank you so much
27:37 haha i see what you did there! 😜
25:30 aahhah Ditto
Dec 7, 2021
Good sir
Python 😍👍🏻👍🏻
How can I learn PYTHON easily, quickly and successfully? Can you tell me if you can?
Practice, Practice and Practice. Keep learning new things.
@@ns8928 Go to freeCodeCamp.org and search for their Python course for beginners by Mike Dane (Giraffe Academy). It's perfect.
shebang 37:55
2nd
1st
4th
3rd