@@syschinesubbie Yeah it's mostly an extremely basic video. This is not a quick "cheat sheet". I knew 90% of the video's contents already by staring at a single python file for 5 minutes instead. But it's not an awful video to play in the background while coding, so I did that... Edit: I just finished the video. It taught me about 1 or 2 new things. And it taught me how to setup Python in VSCode and how to do line by line debugging, and a few very useful VSCode keyboard shortcuts. So this is a good video for learning VSCode. Pretty awful video for learning Python as an experienced programmer (it's a slow beginner-style video). The video didn't even go into the things I was hoping to learn about, such as the weird docstring-annotations that Python uses for functions. Meh.
It is a nice introduction to Python, still, I was hoping for a more advanced level as the name of the video implies. Love the course nonetheless! Thank you Mosh!
Your 1hr 48 min course almost took 12 hrs for me to understand (because I am a beginner and tried to do hands-on practice as you were teaching in the video). Thank you for mentioning everything little thing in detail. ☺️
If it's still not working it must be because the terminal is not in the same folder as your app.py file...your present open folder in the terminal is the last one in the breadcrumb(C:\Users\(etc etc)\(present folder) . Use cd (folder path) to open the folder that the file is present in.
If you want to get rid of the [running] and [done] messages in the output, do this. Go to settings (ctrl + , ). Search [running]. Scroll about halfway down to “Code-runner: Show Execution Message” and deselect the box below it. To have your output clear every time, go to settings, lookup output, deselect “Code-runner: Clear Previous Output” After doing both of those, when I run the code, it looks the same on my terminal as in his.
Great lesson! that last fizzbuzz for anyone intrested in a more robust solution like stringbuilder in java (I couldn't find a stringbuilder in python) Here it is: def fizz_buzz(input) -> str: result = "" if (input % 3 == 0): result = "fizz" if (input % 5 == 0): result += "buzz" if (not result): result = str(input) return result The last part that says not result (Because we know a "" is false so if it is empty (as we initiated it) then we can put a number in that emptiness.
I am a first semester information technology student. I am loving this course. I did some html back in high school, but I plan on spending 2 hours a day, 6 days a week on this video. I am so glad people like you are willing to help people like me. I am so excited for what I really hope to be a brighter future for me. I'm not sure if I will get far enough by may; but I would like to learn enough to make a simple jeopardy comptia 1001 & 1002 study game. I have already made a cool alarm clock python code that plays funny sounds for every break at school. So far I am also glad that you are simplifying it for people like me to understand. I am someone who needed someone willing to break things down and "hold a hand through it" if you know what I mean.
@@programmingwithmosh lol thanks for link. That is the one I thought i was commenting on. I was watching it on tv via ps4 as I followed along on my laptop. I can't comment well on ps4, so i grabbed phone and must have clicked wrong 1 to comment on. But I am following the 6 hour video for now. Ty tho
Hey Mosh, great stuff. I have completed your JavaScript and all of your C# courses, and I think I know more about these topics than some people who should know more than me at this point (experienced devs). A great mix of practical and academic approach to teaching this stuff. Thank you.
Hey Mosh, I have already mastered React by studying your React Course and i am excited for Python course it looks awesome... Thanks for such great Tutorials and please please keep making such type of video and i will take it all..... By the i realize that you look like an Hollywood Start called "Stanley Tucci" !... once again thanks for Tutorials...
When debugging someone else's code str.Substring(0, 3) is more verbose and much easier to understand than str[0:3] . The simplicity is nice when writing or creating but becomes difficult when maintaining. The same can be said about Perl. Dense code is hard to maintain.
str[0:3] is actually not that simple. It might be simple for a python programmer but for someone coming from another island, it's actually harder to read. I never wrote a line in C# but I can understand str.substring(0, 3); just by seeing it in the code, because it is descriptive. Same with js, str.substr(0, 3); is shorter but still describing what it does. str[0:3] doesn't explain anything. You need to know what [ ] means and you need to know what : means. Is it creating an array from index 0 to index 3? Is it assigning int 3 to index 0? Or even filling random numbers from 0-3 into str? It could be anything. It is not clean it is not simple and it is not easy to read. It's quite an anti-pattern for a language that's supposed to be easy to understand. Don't get me wrong, I have used python quite a few times but just because something is shorter it doesn't mean it's better to read and understand.
Highly recommended! This is a great crash course on Python for people with a little programming knowledge. It covers the first two chapters of his eleven chapter course. His class covers seven and a half hours of content beyond what you see here. Also, first time students get a pretty hefty discount!
Got to say, my FizzBuzz was also neat. def fizz_buzz(input): out = "" if input % 3 == 0: out += "Fizz" if input % 5 == 0: out += "Buzz" if out == "": return input return out print(fizz_buzz(30))
I really appreciate you go through what settings you have in VS Code initially. I hate when I get into a beginner tutorial and the instructor immediately dive into coding and I have to manually attempt breakdown their settings myself to follow along easier
What about this solution to the FuzzBuzz thing? This is how I solved it. Please consider that I'm learning Python and this is actually the first video I watch about it. def fizz_buzz(input): stri="" if int(input / 5) == input / 5: stri = "Fizz" if int(input / 3) == input / 3: stri += "Buzz" if stri == "": stri = input return stri print(fizz_buzz(15))
I like the section about 01:36:31 VSCode Coding Tricks (Windows) , very useful. I also noticed that "Ctrl - X" works in VS Code (a command I'm used to from Visual Studio), which means "delete the current line and copy it to the clipboard" (this command requires that NO text is PARTIALLY SELECTED on the line). Anyway, I like that command a lot for getting rid of lines quickly. You can also use "Ctrl - C" with no text selected, to copy the current line to clipboard. And in both the "Ctrl - C" and "Ctrl - X" cases the line is copied to the clipboard, so you can place your cursor on another line and Ctrl-V to paste that line.
In general a "better and cleaner" way does not necessary remove lines of code. For FizzBuzz problem I think a better and cleaner way would be: if input % 3 == 0 result = Fizz if input % 5 result = Buzz return result
It's not that lists are mutable, there's a difference between x = x + 1 and x.append() to show that the id didn't change A better comparison for x = 1, x = x + 1 would be: x = [1,2,3] and then x = [2,3,4] the id of course would change because it is a new list. when you append to an existing list, you don't replace its head, so the id stays the same
I'm a low-level engineer. this is how I did it: #if x is divizible by 3, return fizz, by 5 - buzz, by 3 and 5 - fizbuzz, by neither - x. def fizz_buzz(x): out=['fizzbuzz','buzz','fizz',x] idx = int(x % 3 > 0) + 2 * int(x % 5 > 0) return out[idx] #but thanks for the tutorial, i learned python from you Mosh :-) fizz_buzz(501) 'fizz' fizz_buzz(330) 'fizzbuzz' fizz_buzz(17) 17
Mosh, great tutorials. Just watched the section on Stings. One example not shown is the ability to grab values within a string using a single or double delineator. For example, we have a string mySTR = "one, two, three, four". Now using a single delineator, I want to get the value of the text between the first and second delineator. In a library I used (Called FUNCky) for the Clipper compiler (not sure if you recall that language and library) I'd use StrExtract(mySTR, ",", 2). This would return the string between the first comma and second comma. And if you had string (~One~, ~Two~, ~Three~, ~Four~) you could use two characters to separate the data you're extracting while ignoring the commas StrExtract(mySTR, "~~", 2). The second method would ignore the commas in the string, and just look for pairs of your searching delineators...and they could be any thing, even different characters like "~#". So I'm sure I could write the function to do this, but curious if Python has this built-in, or if you know of a library which contains string functions (and other functional functions). Actually, in my old programming days, we had developers who wrote practical functions, written in C for speed, that we'd be able to access in our code. We'd just incorporate the function library. I'm new to Python (but not not programming) and would love your input on my example above, and if you have advice on libraries for Python. Thank you. -Dave-
I'm running this on Windows, and when doing VSCode on Windows 10, don't use python app.py, just make sure you use the input() at the end of your script (hacky way of getting the cmd to pause for a minute to see the program), and in the terminal, make sure you're at the directory path your app.py is in, then type ".\app.py" to launch the program. The way he described it didn't seem to work, though that's because Windows doesn't run on shell like Mac or Linux.
Just began with Python and I'm enjoying every bit of it. Its syntax is super easy to follow, which makes it a perfect choice for those new to coding. What's more, Python is such a flexible language, opening paths to numerous areas.
Damn it's really amazing how free courses on youtube like this are available. Programming is a very valuable skill, so it's nice to see tutorials like this available for no cost
Let me tell you, Sir, that this is the RIGHT way to teach a programming language. & the fact that you took into consideration that this video is oriented towards programmers is just elegant! I know more than 30 languages & this is my first time with Python, but with the help of this video, I believe I now have a perfect base to advance! Many regards!
Awesome dude! Been following along with Vim, and I found because you explained each thing so well, it was more effective for me to take a lot of notes on what was being taught and then create a whole program out of all of them afterwards. I learned a lot here coming from a background of almost exclusively C-style languages (in terms of syntax) and only a few variations (Assembly language being one of them). I feel like my life has been changed, it's so easy to get stuff up and running in Python! I'm definitely gonna be buying the course sometime soon.
wow Assembly! Bless your heart! learning that was such a nightmare for me but I'm glad i did. thus I'm really glad to be learning Python with these videos. Technical explanations are great
Your table of contents literally saved me from going insane. The amount of times I typed the number 0 thinking I was in the VS Code window to instead reset the video had me SOOOOOO thankful you thought about having the table. Thanks to you, I remain sane for another day!
You always make learning this stuff so enjoyable and engaging, be it the complex or mundane! Best of all, at the end there is a real sense of skill advancement and clarity. Thank you!
since weeks I have been searched for an online tutorial and I am happy that I found you man, your explanation is practical and short enough to get everything. khaste nabashid.
Thanks for the tutorial. Here is my takeaway: "python = tcl - some_rich_programming_constructs" Here is the tcl mindset solution to closing problem. More elegant, wouldn't you say. def fizz_buzz(input): if not input % 3 and not input % 5: return "fizz_buzz" if not input % 3: return "fizz" if not input % 5: return "buzz" return input or def fizz_buzz(input): if input % 3 and input % 5: return input if input % 3: return "buzz" if input % 5: return "fizz" return "fizz_buzz"
Thank you Mosh, especially for your hard work trying to teach us. I think you are the best tutor I've ever been taught. I hope and ask you to fill out your UA-cam channel with a full crash Django course. Please do this for your students !!!
Write an applet that initially displays the word “Hello” in the center of a window. The word should follow the mouse cursor when it moved inside the window.
Great Start Mosh, I love the idea of python for programmers - I don't want to wast my time learning things that i already know (like a beginner). I am a C# Programmer and BI Analyst with 6 Years Experience and I am moving to python for Data Science (AI, ML, etc..). Any Plans to Make a ML Cource using python ?
I can't wait to see the videos for ML and AI. I am actually enrolled for many classes on Udemy before I stumbled on Mosh free tutorials on UA-cam. I immediately went to his site to subscribe for the monthly program after seeing the quality of his videos and the way he explain concepts shows that he's not just an experienced programmer but also knows his onions very well. I will recommend him any day to anyone who wants to truly understand programming. More power to your elbow sir!
hi bro i would like to know more about ML with python . did you get any link to learn ML . if u have please share the details . musthafaabins@gmail.com
#MicroNG ua-cam.com/play/PLTXhDXS96cPUH7tTM2iuGUcLKow6zN6AC.html Learn python with MicroNG _DO LIKE❤ SUBSCRIBE😎 AND SHARE_ 😬 ``` FOR MORE eLearning tutorials```
This s a great Tutorial! I also have a suggestion for the exercise: Isn't it nicer to replace the first line with (if input % 15 == 0:) which is shorter?? Best wishes from Germany!
I truly admire your work here on youtube. I need to stand that I don't find your solution of fizz_buzz most clean. I wrote that a bit differently. Don't you think it's even easier to folllow? def fizz_buzz(input): output=''" if(input%3==0): output+= 'Fizz' if(input%5==0): output+= 'Buzz' return output or input
Im starting with programming and choose python as my first language. Those conditionals(if else) inside variable blow my mind. I did saw a lot of beginners video and some online classes. No one told me that. Thanks!
Forex and binary options isn't as easy as it seems and there are lots of obstacles in it. But with the help of Mr Dagobert Decker, all risk is minimize to it's lowest form ....
Many thanks to Sir Dagobert Decker for making me what i am today with his great strategy, I have made great profits using his strategy ,,, visit dagobertdecker112 @gmail. com to be part of this great opportunity
Regarding the ast chapter, I would argue that this is the simplest and neatest implementation: def fizzbuzz(input): result = "" result += "fizz" if (input % 3 == 0) else "" result += "buzz" if (input % 5 == 0) else "" return result if result else input Anyway, thanks for this great introduction video!
30+ years a programmer here. I'm interested in Python and hope to get into it enough to feel comfortable after dabbling with it before. After 20 years of doing Java for my day job I've gone off it - it's a mess with annotations, auto-wiring 'magic' in frameworks, neat but complex streams/lambdas etc., it's not enjoyable at all. I can't see me doing Python for a living any time soon but I'd like to enjoy programming again!
At 1:24:43 you annotate the increment function as returning "tuple". That's not really correct either. The correct way to annotate it is "from typing import Tuple" at the top of the file, and then annotate the return value as "Tuple[int, int]".
Finally a course for devs. Much appreciated! Even it being basic. Just signed up to receive the early announcement of the avdanced course. But, please, don't let us down. Useful and real world stuff will always worth the investment and will always bring new customers.
I never understood the whole thing around Fizzbuzz, its hard to believe 99% of programers (it's what they say) have dificulty with it, i mean, i guess its mostly about how you code it and not if you can code it or not This was my function based on what i've learned from this video (im actually a web developer so it was mostly a syntax thing coming from php/javascript, you can see that i love the elvis operators / ternary operators) def fizz_buzz(num): fizz = 'Fizz' if num % 3 == 0 else '' buzz = 'Buzz' if num % 5 == 0 else '' if fizz and buzz: return f'{fizz} {buzz}' elif fizz or buzz: return fizz or buzz else: return num I'd actually do a different test when hiring someone for front end, they have to create a basic calculator with html and javascript (with buttons and stuff of course) and if they are going to work in the back end, the calculations have to be done via ajax.
Great video. Running through it now with current version of VSCode (1.40.0). But terminal window doesn't work the way it's described in this video at 8:57. When you type python3 app.py in the terminal window in VSCode, nothing happens. But when you hit the Run Code button the output appears in the Output terminal. I guess VSCode has changed a lot since this video was uploaded in October 2018.
Hi Mosh, I want to get a job in the field of Machine Learning, I have started learning Python with this video. Could you please suggest me that what all things should I learn step by step after this video so that I can get a job in the field of Machine Learning? Thank you!
Thanks! Awesome way to explain the root theories of how things are linked together (Editors and IDEs, or what you really mean from mutable vs immutable) No one else does this, its been very helpful. Thanks!
43:22 - That's not an accurate way to describe this, but speaking in general language terms... course is a class (or object) as you said earlier, than the id(course) is a pointer index to the class, and id(course[0]) is a pointer index to the first character of the string that is allocated on the heap.
Unclear: Why is it True, if the naming convention is snake_casing? Shouldn´t it be true? Is this indicative of something? I notices classes are also int, string, float and bool. In other languages we use the convention that a class has a Capital letter, where an instance has a lowercase letter. I am more confusion..? I thought this was a course for programmers. This is actually a important and informative bit of convention and you gloss over it. Last chance at 34:33, continuing at 2x speed.
Hey Mosh What's the color theme you use in this visula studio code plz tell me And as always, your video and it's content are awesome I watched 2 times whole video without any skip. A big thanks to be my teacher without any fee. Thank you so much.
My FizzBuzz: def fizz_buzz(input): result = "" if input % 3 == 0: result += "Fizz" if input % 5 == 0: result += "Buzz" if not result: result = input return result print(fizz_buzz(3))
Exactly what I was thinking. The example in the video is horrible coding, because it does four modulo operations (they are not fast). Yours is a much more appropriate method.
OR: def fizz_buzz(input): if not (input % 3) and not (input % 5): return "fizz_buzz" if not (input % 3): return "fizz" if not (input % 5): return "buzz" return input
You are great just completed your beginner course and just came for this for learning more some few more key concepts like type annotation and mutable and immutable
I need to learn Python soon as part of work, I have Java background ... was in a bit fear knowing nothing in Python.. Then I found your videos including this; I am sure , I can become a decent Python programmer too soon.. : ) you made it so simple .. Your videos are giving great confidence !!! Thanks a ton!!
When splitting a string using notation such as 0:3 are you sure the second parameter is not simply just the number of characters to grab, starting from the index specified in the first param? That's the way it seems to behave isn't it, rather than being an index itself.
For anyone who just wants know how to code Python, and already knows all the background stuff or doesn't care: go to 30:00
thank you!
Wish I would’ve found this about a half hour ago lol
@@popecosh307 me too
not all heroes wear capes
Thank You
Python crash course for developers
also
"If you're not familiar with variables, don't worry.."
@@syschinesubbie Yeah it's mostly an extremely basic video. This is not a quick "cheat sheet". I knew 90% of the video's contents already by staring at a single python file for 5 minutes instead. But it's not an awful video to play in the background while coding, so I did that...
Edit: I just finished the video. It taught me about 1 or 2 new things. And it taught me how to setup Python in VSCode and how to do line by line debugging, and a few very useful VSCode keyboard shortcuts. So this is a good video for learning VSCode. Pretty awful video for learning Python as an experienced programmer (it's a slow beginner-style video). The video didn't even go into the things I was hoping to learn about, such as the weird docstring-annotations that Python uses for functions. Meh.
i assume he meant variable creation with Python, not variables in general lmao
Wow tough crowd
What are those variables you speak of
You have a point, but he shows a lot of interesting stuff too, especially concerning using Python in VSCode.
Those 300 dislikes are from those computer science teachers who saw this and were jealous of your teaching skills
It is a nice introduction to Python, still, I was hoping for a more advanced level as the name of the video implies.
Love the course nonetheless!
Thank you Mosh!
Your 1hr 48 min course almost took 12 hrs for me to understand (because I am a beginner and tried to do hands-on practice as you were teaching in the video).
Thank you for mentioning everything little thing in detail.
☺️
Same here
@@chiragkumarchavda8546 Yeah me too
edit: in windows with newer versions type py app.py not python app.py (took me a sec so if someone is looking in comments for why it complained)
thank you so much.. I was struggling for good 20 minutes.
this still doesnt do anything for me...
@@xorgfx-y4l py app.py
works for me :)
thank you!!!!
If it's still not working it must be because the terminal is not in the same folder as your app.py file...your present open folder in the terminal is the last one in the breadcrumb(C:\Users\(etc etc)\(present folder) . Use cd (folder path) to open the folder that the file is present in.
Python is mind blowing after working on C++ & Java for many years !!! Too Simple & too easy ❤️❤️
Too slow.
If you want to get rid of the [running] and [done] messages in the output, do this. Go to settings (ctrl + , ). Search [running]. Scroll about halfway down to “Code-runner: Show Execution Message” and deselect the box below it.
To have your output clear every time, go to settings, lookup output, deselect “Code-runner: Clear Previous Output”
After doing both of those, when I run the code, it looks the same on my terminal as in his.
> for developers
> explains what an IDE is
thought exactly the same
noo
yeah... :(
answers my question
😂😂😂
Great lesson! that last fizzbuzz for anyone intrested in a more robust solution like stringbuilder in java (I couldn't find a stringbuilder in python) Here it is:
def fizz_buzz(input) -> str:
result = ""
if (input % 3 == 0):
result = "fizz"
if (input % 5 == 0):
result += "buzz"
if (not result):
result = str(input)
return result
The last part that says not result (Because we know a "" is false so if it is empty (as we initiated it) then we can put a number in that emptiness.
Thank you for quick tutorial!
h a m p s t e r
Basic Language Constructs: First 1:19
Functions : 1:20 - 1:24
Functions Optional Args : 1:24 - 1:27
Dictionaries : 1:27 - 1:29
Variable Scope : 1:29 - 1:33
Debugging : 1:33 - 1:36
Shortcuts Win VSCode : 1:36 - 1:39
Shortcuts Mac VSCode : 1:39 - 1:41
fizz_buzz : 1:41 - 1:48
def fizz_buzz(input):
message = "Fizz" if not input % 3 else ""
message += "Buzz" if not input % 5 else ""
return message if message else input
As always, everything is clear and nicely structured into a short video.
Thank you Mosh, and good luck!
I am a first semester information technology student. I am loving this course. I did some html back in high school, but I plan on spending 2 hours a day, 6 days a week on this video. I am so glad people like you are willing to help people like me. I am so excited for what I really hope to be a brighter future for me. I'm not sure if I will get far enough by may; but I would like to learn enough to make a simple jeopardy comptia 1001 & 1002 study game. I have already made a cool alarm clock python code that plays funny sounds for every break at school. So far I am also glad that you are simplifying it for people like me to understand. I am someone who needed someone willing to break things down and "hold a hand through it" if you know what I mean.
@@programmingwithmosh lol thanks for link. That is the one I thought i was commenting on. I was watching it on tv via ps4 as I followed along on my laptop. I can't comment well on ps4, so i grabbed phone and must have clicked wrong 1 to comment on. But I am following the 6 hour video for now. Ty tho
Hey Mosh, great stuff. I have completed your JavaScript and all of your C# courses, and I think I know more about these topics than some people who should know more than me at this point (experienced devs). A great mix of practical and academic approach to teaching this stuff. Thank you.
🕹🕹🕹🖲🕹🕹🕹🕹🕹🖲🖲🖲🖲🖲🖲🖲🖲📷🕹🎥🎥🎥🎥📽📽📽📽📽📽💿💿💿💾💿💿💿💿💿🖨🖨🖨🖨🖨🖨🖨🖨🖥🖥🖥🖥🖥⌨️⌨️⌨️⌨️⌨️💻💻💻💻📲📲📲📱📱📱⌚⌚⌚⌚⌚⌚⌚🖱🖱🖱🖲🖲🖲🖲🖲🕹🕹🕹🕹🗜🗜💽💽💽💽💾💾📀📀📼📼📼📷📷📷📸📸📸📹📹📹🎥🎥🎥📽😀😀😃😄😁😁😁😆😆😅😅😂🤣☺😊😇🙂🙃😉😍🥰😘😗😚🐶🐱🐭🐹🐰🦊🐻🐼🐨🐯🦁🐮🐷🐽🐵🙈🙉🙊🐒🐔🍏🍎🍐🍊🍋🍌🍉🍇🍓🍈🍒🍑🥭🍍🥝🥑🍅🍆🥦🥬⚽🏀🏈⚾🥎🎾🏐🏉🥏🎱🪀🏓🏸🥅🏒🏒🏑🏑🥍🏏⛳🪁🏹🚗🚕🚙🚌🚎🏎🚓🚑🚒🚐🚚🚛🚜🦽🦼🛴🚲🛵🏍🛺🚨❤🧡💛💚💙💜🖤🤍🤎💔❣️💕💞✝️💗💖💘💝💟☮️✝️🏳🏴🏴☠️🏁🚩🏳🌈🇦🇽🇦🇱🇦🇸🇦🇴🇦🇮🇦🇶🇦🇬🇦🇲🇦🇼🇧🇪
Hey Mosh, I have already mastered React by studying your React Course and i am excited for Python course it looks awesome...
Thanks for such great Tutorials and please please keep making such type of video and i will take it all.....
By the i realize that you look like an Hollywood Start called "Stanley Tucci" !...
once again thanks for Tutorials...
When debugging someone else's code str.Substring(0, 3) is more verbose and much easier to understand than str[0:3] . The simplicity is nice when writing or creating but becomes difficult when maintaining. The same can be said about Perl. Dense code is hard to maintain.
str[0:3] is actually not that simple. It might be simple for a python programmer but for someone coming from another island, it's actually harder to read.
I never wrote a line in C# but I can understand str.substring(0, 3); just by seeing it in the code, because it is descriptive. Same with js, str.substr(0, 3); is shorter but still describing what it does. str[0:3] doesn't explain anything. You need to know what [ ] means and you need to know what : means. Is it creating an array from index 0 to index 3? Is it assigning int 3 to index 0? Or even filling random numbers from 0-3 into str? It could be anything.
It is not clean it is not simple and it is not easy to read. It's quite an anti-pattern for a language that's supposed to be easy to understand.
Don't get me wrong, I have used python quite a few times but just because something is shorter it doesn't mean it's better to read and understand.
thank you!
Highly recommended! This is a great crash course on Python for people with a little programming knowledge. It covers the first two chapters of his eleven chapter course. His class covers seven and a half hours of content beyond what you see here. Also, first time students get a pretty hefty discount!
Got to say, my FizzBuzz was also neat.
def fizz_buzz(input):
out = ""
if input % 3 == 0:
out += "Fizz"
if input % 5 == 0:
out += "Buzz"
if out == "":
return input
return out
print(fizz_buzz(30))
I really appreciate you go through what settings you have in VS Code initially. I hate when I get into a beginner tutorial and the instructor immediately dive into coding and I have to manually attempt breakdown their settings myself to follow along easier
@@programmingwithmosh I think a balance needs to be involved and even then can't please everyone but I found yours pretty good 😁
@@programmingwithmosh What theme are you using. I really like it but I'm struggling to find it.
What about this solution to the FuzzBuzz thing? This is how I solved it. Please consider that I'm learning Python and this is actually the first video I watch about it.
def fizz_buzz(input):
stri=""
if int(input / 5) == input / 5:
stri = "Fizz"
if int(input / 3) == input / 3:
stri += "Buzz"
if stri == "":
stri = input
return stri
print(fizz_buzz(15))
I like the section about 01:36:31 VSCode Coding Tricks (Windows) , very useful. I also noticed that "Ctrl - X" works in VS Code (a command I'm used to from Visual Studio), which means "delete the current line and copy it to the clipboard" (this command requires that NO text is PARTIALLY SELECTED on the line). Anyway, I like that command a lot for getting rid of lines quickly. You can also use "Ctrl - C" with no text selected, to copy the current line to clipboard. And in both the "Ctrl - C" and "Ctrl - X" cases the line is copied to the clipboard, so you can place your cursor on another line and Ctrl-V to paste that line.
Set the video to 2x and learned Python in less than an hour, thanks Mosh! :)
Wow. You explain things so beautifully and simply. Thank you so much for this video. You have gained a new subscriber.
In general a "better and cleaner" way does not necessary remove lines of code.
For FizzBuzz problem I think a better and cleaner way would be:
if input % 3 == 0
result = Fizz
if input % 5
result = Buzz
return result
It's not that lists are mutable, there's a difference between x = x + 1 and x.append() to show that the id didn't change
A better comparison for x = 1, x = x + 1 would be:
x = [1,2,3] and then x = [2,3,4] the id of course would change because it is a new list. when you append to an existing list, you don't replace its head, so the id stays the same
I'm a low-level engineer. this is how I did it:
#if x is divizible by 3, return fizz, by 5 - buzz, by 3 and 5 - fizbuzz, by neither - x.
def fizz_buzz(x):
out=['fizzbuzz','buzz','fizz',x]
idx = int(x % 3 > 0) + 2 * int(x % 5 > 0)
return out[idx]
#but thanks for the tutorial, i learned python from you Mosh :-)
fizz_buzz(501)
'fizz'
fizz_buzz(330)
'fizzbuzz'
fizz_buzz(17)
17
Mosh, great tutorials. Just watched the section on Stings. One example not shown is the ability to grab values within a string using a single or double delineator. For example, we have a string mySTR = "one, two, three, four". Now using a single delineator, I want to get the value of the text between the first and second delineator. In a library I used (Called FUNCky) for the Clipper compiler (not sure if you recall that language and library) I'd use StrExtract(mySTR, ",", 2). This would return the string between the first comma and second comma. And if you had string (~One~, ~Two~, ~Three~, ~Four~) you could use two characters to separate the data you're extracting while ignoring the commas StrExtract(mySTR, "~~", 2). The second method would ignore the commas in the string, and just look for pairs of your searching delineators...and they could be any thing, even different characters like "~#". So I'm sure I could write the function to do this, but curious if Python has this built-in, or if you know of a library which contains string functions (and other functional functions). Actually, in my old programming days, we had developers who wrote practical functions, written in C for speed, that we'd be able to access in our code. We'd just incorporate the function library. I'm new to Python (but not not programming) and would love your input on my example above, and if you have advice on libraries for Python. Thank you. -Dave-
I'm running this on Windows, and when doing VSCode on Windows 10, don't use python app.py, just make sure you use the input() at the end of your script (hacky way of getting the cmd to pause for a minute to see the program), and in the terminal, make sure you're at the directory path your app.py is in, then type ".\app.py" to launch the program. The way he described it didn't seem to work, though that's because Windows doesn't run on shell like Mac or Linux.
Just began with Python and I'm enjoying every bit of it. Its syntax is super easy to follow, which makes it a perfect choice for those new to coding. What's more, Python is such a flexible language, opening paths to numerous areas.
thanks mosh i really love this course u are the best tutor a student would have😎😎
Damn it's really amazing how free courses on youtube like this are available. Programming is a very valuable skill, so it's nice to see tutorials like this available for no cost
Let me tell you, Sir, that this is the RIGHT way to teach a programming language.
& the fact that you took into consideration that this video is oriented towards programmers is just elegant!
I know more than 30 languages & this is my first time with Python, but with the help of this video, I believe I now have a perfect base to advance!
Many regards!
Awesome dude! Been following along with Vim, and I found because you explained each thing so well, it was more effective for me to take a lot of notes on what was being taught and then create a whole program out of all of them afterwards. I learned a lot here coming from a background of almost exclusively C-style languages (in terms of syntax) and only a few variations (Assembly language being one of them). I feel like my life has been changed, it's so easy to get stuff up and running in Python!
I'm definitely gonna be buying the course sometime soon.
wow Assembly! Bless your heart! learning that was such a nightmare for me but I'm glad i did. thus I'm really glad to be learning Python with these videos. Technical explanations are great
This guy sat for an hour.Thank so much😇
PERFECT , exactly what I wanted.
THANKS MAN.
Your table of contents literally saved me from going insane. The amount of times I typed the number 0 thinking I was in the VS Code window to instead reset the video had me SOOOOOO thankful you thought about having the table. Thanks to you, I remain sane for another day!
You always make learning this stuff so enjoyable and engaging, be it the complex or mundane! Best of all, at the end there is a real sense of skill advancement and clarity. Thank you!
since weeks I have been searched for an online tutorial and I am happy that I found you man, your explanation is practical and short enough to get everything. khaste nabashid.
Thanks for the tutorial. Here is my takeaway:
"python = tcl - some_rich_programming_constructs"
Here is the tcl mindset solution to closing problem. More elegant, wouldn't you say.
def fizz_buzz(input):
if not input % 3 and not input % 5:
return "fizz_buzz"
if not input % 3:
return "fizz"
if not input % 5:
return "buzz"
return input
or
def fizz_buzz(input):
if input % 3 and input % 5:
return input
if input % 3:
return "buzz"
if input % 5:
return "fizz"
return "fizz_buzz"
Thank you Mosh, especially for your hard work trying to teach us. I think you are the best tutor I've ever been taught. I hope and ask you to fill out your UA-cam channel with a full crash Django course. Please do this for your students !!!
def fizz_buzz(input):
str = ""
if input % 3 == 0:
str += "fizz"
if input % 5 == 0:
str += "Buzz"
if not str:
str = input
return str
Wowww.... Dedication level is visible in the description box... Wow... Good one.. going through it now.. i am sure it will be of great use.
Thank u
Overall Awesome tutorial and it gave me new direction in python.. but ads really disturbed me when i was in flow of learning.
your vids make coding looks so simple ....
love from india and keep it up
Write an applet that initially displays the word “Hello” in the center of a window. The word should follow the mouse cursor when it moved inside the window.
Great Start Mosh, I love the idea of python for programmers - I don't want to wast my time learning things that i already know (like a beginner).
I am a C# Programmer and BI Analyst with 6 Years Experience and I am moving to python for Data Science (AI, ML, etc..).
Any Plans to Make a ML Cource using python ?
I can't wait to see the videos for ML and AI. I am actually enrolled for many classes on Udemy before I stumbled on Mosh free tutorials on UA-cam. I immediately went to his site to subscribe for the monthly program after seeing the quality of his videos and the way he explain concepts shows that he's not just an experienced programmer but also knows his onions very well. I will recommend him any day to anyone who wants to truly understand programming. More power to your elbow sir!
@@abiodunanifowose7913 +1 AI/ML by mosh :-)
hi bro i would like to know more about ML with python . did you get any link to learn ML . if u have please share the details . musthafaabins@gmail.com
#MicroNG
ua-cam.com/play/PLTXhDXS96cPUH7tTM2iuGUcLKow6zN6AC.html
Learn python with MicroNG
_DO LIKE❤ SUBSCRIBE😎 AND SHARE_ 😬
```
FOR MORE eLearning tutorials```
Can you please make tutorials on Java programming.
My implementation of FizzBuzz:
def fizz_buzz(user_num):
fb_string = ""
if int(user_num) % 3 == 0:
fb_string = "Fizz"
if int(user_num) % 5 == 0:
fb_string += "Buzz"
else:
return user_num
return fb_string
print(fizz_buzz(3))
print(fizz_buzz(5))
print(fizz_buzz(15))
print(fizz_buzz(7))
This s a great Tutorial! I also have a suggestion for the exercise:
Isn't it nicer to replace the first line with (if input % 15 == 0:) which is shorter??
Best wishes from Germany!
Hi Mosh you are the best.I just love your teaching.😍
I truly admire your work here on youtube. I need to stand that I don't find your solution of fizz_buzz most clean. I wrote that a bit differently. Don't you think it's even easier to folllow?
def fizz_buzz(input):
output=''"
if(input%3==0):
output+= 'Fizz'
if(input%5==0):
output+= 'Buzz'
return output or input
This was incredibly helpful, especially the VS code settings & shortcuts walkthrough, thanks!
Im starting with programming and choose python as my first language. Those conditionals(if else) inside variable blow my mind. I did saw a lot of beginners video and some online classes. No one told me that. Thanks!
That presentation is just top notch 👍. it would be nice if you upload some course completely for your youtube subscribers
Thank you for your courses
I am from Uzbekistan
I want to be a programmer like you in the future
Forex and binary options isn't as easy as it seems and there are lots of obstacles in it. But with the help of Mr Dagobert Decker, all risk is minimize to it's lowest form ....
Many thanks to Sir Dagobert Decker for making me what i am today with his great strategy, I have made great profits using his strategy ,,, visit dagobertdecker112 @gmail. com to be part of this great opportunity
Mr Dagobert is willing to work with you and teach you his exact strategy. And you can make consistent winning from there
Regarding the ast chapter, I would argue that this is the simplest and neatest implementation:
def fizzbuzz(input):
result = ""
result += "fizz" if (input % 3 == 0) else ""
result += "buzz" if (input % 5 == 0) else ""
return result if result else input
Anyway, thanks for this great introduction video!
def FizzBuzz(input):
result = "Fizz" if (input % 3 == 0) else ""
result += "Buzz" if (input % 5 == 0) else ""
return result if result else input
@@iamraj12345 nice, I didn't see that! :)
30+ years a programmer here. I'm interested in Python and hope to get into it enough to feel comfortable after dabbling with it before.
After 20 years of doing Java for my day job I've gone off it - it's a mess with annotations, auto-wiring 'magic' in frameworks, neat but complex streams/lambdas etc., it's not enjoyable at all.
I can't see me doing Python for a living any time soon but I'd like to enjoy programming again!
At 1:24:43 you annotate the increment function as returning "tuple". That's not really correct either. The correct way to annotate it is "from typing import Tuple" at the top of the file, and then annotate the return value as "Tuple[int, int]".
The best tutor..!You have explained very well...!
def fizzbuzz(num: int):
return "FizzBuzz" if num % 3 == 0 and num % 5 == 0 else "Fizz" if num % 3 == 0 else "Buzz" if num % 5 == 0 else num
You're a great teacher. I really admire you.
Finally a course for devs. Much appreciated! Even it being basic.
Just signed up to receive the early announcement of the avdanced course. But, please, don't let us down. Useful and real world stuff will always worth the investment and will always bring new customers.
I never understood the whole thing around Fizzbuzz, its hard to believe 99% of programers (it's what they say) have dificulty with it, i mean, i guess its mostly about how you code it and not if you can code it or not
This was my function based on what i've learned from this video (im actually a web developer so it was mostly a syntax thing coming from php/javascript, you can see that i love the elvis operators / ternary operators)
def fizz_buzz(num):
fizz = 'Fizz' if num % 3 == 0 else ''
buzz = 'Buzz' if num % 5 == 0 else ''
if fizz and buzz:
return f'{fizz} {buzz}'
elif fizz or buzz:
return fizz or buzz
else:
return num
I'd actually do a different test when hiring someone for front end, they have to create a basic calculator with html and javascript (with buttons and stuff of course) and if they are going to work in the back end, the calculations have to be done via ajax.
Mosh, you are one of the best teachers out there in being able to teach programming so easily 🎉⭐️⭐️⭐️⭐️⭐️
one of the best videos about async. keep up.
from a beginner (in python):
def fizzbuzz(n):
r = ""
if n % 3 == 0:
r = "Fizz"
if n % 5 == 0:
r += "Buzz"
return r if r else n
I really enjoyed and very simple and clean explanation to get into python world of programming. Thank you mosh for this great effort.
Ada has the same array indexing. C# has dynamic types too.
49:37 , I'm leaving this here so that I would know where to start from next time I come.
Mosh has a gift for teaching, excellent style and presentation. class Act:
This vid will surely help me in learning Python for my school A.I, ML and DL project.
Thnx Sir Mosh!!
Great video. Running through it now with current version of VSCode (1.40.0). But terminal window doesn't work the way it's described in this video at 8:57. When you type python3 app.py in the terminal window in VSCode, nothing happens. But when you hit the Run Code button the output appears in the Output terminal. I guess VSCode has changed a lot since this video was uploaded in October 2018.
What do you think @Mosh?
def fizz_buzz(a:int):
res = ""
if a % 3 == 0: res = "Fizz"
if a % 5 == 0: res += "Buzz"
return str(a) if not res else res
There are lots of keyboard layouts that don't have Ctrl-backtick where you say it is.
Hi Mosh, I want to get a job in the field of Machine Learning, I have started learning Python with this video. Could you please suggest me that what all things should I learn step by step after this video so that I can get a job in the field of Machine Learning? Thank you!
Thanks! Awesome way to explain the root theories of how things are linked together (Editors and IDEs, or what you really mean from mutable vs immutable) No one else does this, its been very helpful. Thanks!
Mosh you are great 👍. Thanks
Only 28 mins in and I'm already drowning in quality. Good job!
this video is the best revision one can ever have in 1 hour ,Thank you so much :D
Sir
I'm from Bangladesh flowing your tutorial it's helpful.
i see... you are really flowing
@Mosh: Why do you use if (input % 3 == 0) and (input % 5 == 0 ): instead of if input % 15 == 0:
43:22 - That's not an accurate way to describe this, but speaking in general language terms... course is a class (or object) as you said earlier, than the id(course) is a pointer index to the class, and id(course[0]) is a pointer index to the first character of the string that is allocated on the heap.
I work with py and c# daily but look at me, glued to my screen. Awesome as always Mosh. Why aren't u at 1M subscribers yet?
I just can't thank you enough for this. Keep up the good work.
Unclear: Why is it True, if the naming convention is snake_casing? Shouldn´t it be true? Is this indicative of something? I notices classes are also int, string, float and bool. In other languages we use the convention that a class has a Capital letter, where an instance has a lowercase letter. I am more confusion..? I thought this was a course for programmers. This is actually a important and informative bit of convention and you gloss over it. Last chance at 34:33, continuing at 2x speed.
Hey Mosh
What's the color theme you use in this visula studio code plz tell me
And as always, your video and it's content are awesome
I watched 2 times whole video without any skip.
A big thanks to be my teacher without any fee.
Thank you so much.
dracula
res = ''
if not input % 3: res += 'Fizz'
if not input % 5: res += 'Buzz'
return res or input
My FizzBuzz:
def fizz_buzz(input):
result = ""
if input % 3 == 0:
result += "Fizz"
if input % 5 == 0:
result += "Buzz"
if not result:
result = input
return result
print(fizz_buzz(3))
Exactly what I was thinking. The example in the video is horrible coding, because it does four modulo operations (they are not fast). Yours is a much more appropriate method.
OR:
def fizz_buzz(input):
if not (input % 3) and not (input % 5):
return "fizz_buzz"
if not (input % 3):
return "fizz"
if not (input % 5):
return "buzz"
return input
Woooooooooooooow you have a talent of teaching❤
You are great just completed your beginner course and just came for this for learning more some few more key concepts like type annotation and mutable and immutable
Exactly what I've wanted to know.
I learned a lot from your videos. Thanks. 🍒
I need to learn Python soon as part of work, I have Java background ... was in a bit fear knowing nothing in Python..
Then I found your videos including this;
I am sure , I can become a decent Python programmer too soon.. : ) you made it so simple ..
Your videos are giving great confidence !!! Thanks a ton!!
When splitting a string using notation such as 0:3 are you sure the second parameter is not simply just the number of characters to grab, starting from the index specified in the first param? That's the way it seems to behave isn't it, rather than being an index itself.