Python Tutorial - Your First Program
Vložit
- čas přidán 11. 07. 2024
- If you want to get into computer programming, one easy way is to use Python. Here is a quick tutorial which will show you how to get started with Python programming on Windows.
Twitter: / garyexplains
Instagram: / garyexplains
####
import random
n = random.randint(1,10)
print("I am thinking of a number between 1 and 10")
running = True
while running:
guess_str = input("Take a guess ")
guess = int(guess_str)
if guess == n:
print("Well done, that is right!")
running = False
elif guess < n:
print("Try a bigger number")
else:
print("Try a smaller number")
#####
---
Python Tutorial for Beginners
Introduction to Python Programming
Learn Python
Python for Windows
---
Waited for this video for so long and finally it's here, love your videos
Super, just what I needed, right to the point. Voila, never programmed in Python and now I entered a program and ran it, successfully.
Star going up on fridge.
brilliantly explained with exactly what is essential to start with.. Keep up the great work..
I'm an old BASIC programmer. And really want to earn Python to use with my Raspberry PI. So This is perfect to give me an idea of how things work.
Thank you so much.
Love it and simple! I had issues with that while loop now i get it , ill keep this video as a reference 👌💯
Thank you! I appreciate this tutorial.
Thanks Gary !!! Excellent
Nice.. great one.. thanks for the great videos ..😁😁👍👍👍👍
This was very helpful. Thank you.
wow, such an outstanding tutorial video. On the third try, I got it.
hello Gary, am a beginner in python . you just blow up my head now. am impressed Thanks
Please make more videos like this...ur way of teaching is great 👍
Thank you, i just got into programming and i don't really know what i just did. But im happy i have my first working code, still a lot to learn
Fantastic work Gary! Thank you so much for the tutorial. Making my #100DaysOfPython Day3 so easy!
Glad it helped!
yes, please more on python and programming
Make a video on basic "terms" of programming. Like variable function and so on. It would be much helpful for beginners to get start with the programming. Thanks!
Variables are used to store data such as x=8
Loved it
I would be interested in learning why python of other languages. And maybe seeing some basic programs too. Just not every video. Keep up the great work!
thanks a lot gary
i purchased already the "learn to make app in android", degit course, and it's really to thank you for the effort you make in teaching other thanks
My pleasure, did you sign up for the Slack channel yet?
Gary Explains no . Can you give me the link . And please continue the python learning via exemple, its really motivating way to learn.
Thank you again
Although I have been spending the past few hours coding a RNN on python, i still see this introductory video to the full 😂😂😂
Please make awesome videos like this.
We will wait
Thanks alot
Thanks for a nice Python video. I think learning Python will be easier via a structured course rather than ad-hoc youtube videos.
I think a good idea for a mini-series is an overview of each individual language, what is it good for and how to get started (e.g. best courses online) - Python would be a great start
Very nice, thanks!
Glad you like it!
very good video , thans for the info
Glad you liked it
Thanks so much Gary! Do you have a personal website?
Can’t wait to try this today after work! (Noob here)
This need more likes!!!
o shitt you should do more of these for other language too, and maybe make a playlist out of it
thanks !!!!
Thank you! Now I understand it better (Subscriber Gained)😄
Thank you sir =)
Does python also manage memory automatically ?
Does it support pointers ?
Cool video, I personally use VB and I'm just starting to learn python, and this was simple and easy to follow.
A video suggestion : How to dual boot windows and linux. Hope you take in to consideration.
That is a good suggestion, I will add it to my TODO list!
Great tutorial but can i use random.randit with letters?
How do you start with all those spaces, :,""...
Wonderful1
Hey please make a video about the key differences in c , c++, Java and Python.
yes, i second this!!!
Sounds like and interesting idea. Maybe a history of computer programming languages from Fortran to the present day.
Gary Explains That’s good sir , we are expecting a video like that !!! I just love your explanation style,,, I have learned much from your videos !!!
So, I've decided finally that I'll learn python after my FreeCodeCamp course
Professor can you make an data science using python step by step series that is what many of us will want.
After, I've installed python . Written my first project.
What then?
Do can I run it on computer? Phone? What are the steps After. Do I need to install python in all things? Or what how does it work
More Python please!
Notification Squad!
What is Minimum requirements for my pc to run it?
Please more python videos
Python is the ultimate high level language especially for learning. I learned on VB and C which was much less straight forward. Some people don't realize how powerful python actually is.
Sean Corcoran python is great because it's easy to learn and has lots of practical uses. Machine learning is often done using python since python has lots of machine learning and data analysis tools that are super efficient since they are implemented in C or C++
VB is also easy.
Notification Squad!😎😎
Jeetu Rajpoot CZcams uses service workers (written in Javascript) to send you notifications even when you are not with your browser opened :)
Make more please :)
*GARY!*
*Afternoon, professor!*
Hey Zaman.
*ZAMAN!!!*
Mark Keller LOL.
So i have code like this, what do you do with them.because if i want my friend to try my program out. Its too much effort for the friend to download and install python.
Take a look at pyinstaller.org/ - PyInstaller bundles a Python application and all its dependencies into a single package. The user can run the packaged app without installing a Python interpreter or any modules. PyInstaller is tested against Windows, MacOS X, and Linux.
does python use double or float for decimal numbers? I think a python series would be a great idea!
Double.
It's amazing.... Just make a series of videos teaching python
"Just" as in I shouldn't do any other types of videos, "just" Python?
I say make your channel the way you want it. Of course you want more of us watching your channel. But, you can't make everybody happy. Plenty of Learning Python channels anyway. I like this one, Socratica Channel. I like your channel, even yourself haven't find the format goal your seeking just yet.
Thanks for the tutorial but is there a way where i can make the program print the random number that generated?
Yes, of course. Just add this line at the point you want it printed: print(n)
@@GaryExplains thank you
CLASS STAND GOOD EVENING PROFESSOR
Sir it was a Great Video. Pls make More Videos On Programming..
Sir Pls Kindly Tell How did you Customize the Restart Path In The Shell Window??
I didn't customize it, that is where I installed Python.
Thank you very much for replying Sir . I was asking how do you customised the restart followed by the path command at the centre ================Restart===== like this.
waiting for Gary to explain Ruby programming language ഹുഹുഹു.👍🏼👍🏼👍🏼👍🏼👍🏼
കി കി കി
Ajmal Najath havu oru malayali
When I run python it runs in some CMD type of window and gives no options for file, run etc. I can't see how to make it come up in the Notepad type layout in the video. I can't save a file, run a file etc.
You’re supposed to write ur code in an editor.
If you’re in a command terminal in Linux, then you can use the text editor ‘nano’.
So you create a file ‘temp’ by writing ‘nano temp.py’ and then it opens the editor. That’s where you write your code.
Sir probably you could have started with the basics like variables and things. Importing and working with modules is quite big🔥
Yes, I could have, but that wasn't the goal.
Alenkruth Murali Yeah, like importing just one function from the module.
@@GaryExplains if the goal wasn't to make a tutorial for beginners maybe you should've titled the video in a way that doesn't imply such an idea?
The title does not say begginer.
Is this gonna be a series???
There will certainly be more programming and software development videos, the format etc is still unclear to me.
ohkay ... maybe you can cover different libraries since there are many python tutorials but not a good 'python libraries' playlist. Just an idea.
Good evening professor.
Good evening Robby!
why did it turn out to be the no.9
I tryed the run it did not work
2:36 Oh, I see.
Garry make one for Mac OS also
Writing a Python program on macOS? macOS comes with Python built-in. So you just need to open a terminal window and run the program with "python myprog.py"
Sir, i follow all of your explain videos.... I want to be a android rom developer. Is it mandatory to know programming languages for that??? If yes, than which language do i have to learn??? I watched your video on how to develop rom but i am not clear about this. Please help me...
Mohammad Raihan Yes, you need to how to program if you want to change any of the apps or the internals. Did you see I have an Android App development course? goo.gl/GhaoFW
Coupon is not applying.... 🙁
Sir basically i just want to build aosp based custom rom(lineage,resurrection remix) for varoius devices.... For that what should be my steps???
@@mohammadraihan8624 google
I am able to get this to work but I can only do a really simple one:
import random
n = random.randint(1,10)
print("I am thinking of a number between 1 and 10")
running = True
while running:
guess_str = input("Take a guess ")
guess = int(guess_str)
if guess == n:
print("Well done, that is right!")
running = False
else:
print("You Wrong")
interesting content. Suggest you loose the not relevent screen shot of some boats that take up about 40% of the screen picture - Readability is important. It's not what YOU see but what you want the viewer to be able to see.
*GARY!!!*
*Afternoon Professor!!!*
MARK!!!
Can we use python for AI programming
Yes you can, in fact Python is the language of choice for lots of machine learning experts.
Thank you sir
Recently Google is taking a lot of effort porting their well known machine learning library TensorFlow to javascript js.tensorflow.org :) now it's easier than ever to get started with it.. And get heavy computation running directly on your GPU
Python python python especially (python function)
Finally I have an excuse to learn python.
how can i make something with a GUI that can talk to an API?
You need to walk before you can run.
One alternative is electronjs.org Electron... It uses javascript trought nodejs to write your application logic and HTML/CSS to write the 'GUI'.. It's simple very easy to build anything with it.. :)
There is also nectarjs.com which is trying to compile javascript to native code in every platform... Last time(about a year ago) I checked was limited to a small set of features but it was cool enough..
Learn programming in JavaScript! No installation needed :)
Javascript indeed... I thought torture was outlawed under the UN convention!
Gary Explains yeah newbies will have no problem understanding scope and sycronous code with JS as first language. How could you recommend something easier like python. Shame :)
SIR MAKE TUTORIAL IN DETAILS. PLEASE
Btw I love your videos but this one would have been better if it would have had at least a little depth. Like maybe telling a little bit about Python. Like telling that numbers are pseudo-random and not random. I am saying because you are very good at explaining and people will easily get it.
All of that is true, but that wasn't the aim of the video.
Ya thats right but would develop more interest if one would know what Python is and some use cases. Not needed but not a bad addition either.
This isn't the only video on Python that I will make, plus for it is ALWAYS best to give viewers an actual result, even in the first video/chapter/post. I am happy with the scope of this video.
Okay cool :)
ok so i do EVERYTHING totaly same as him and i get syntax error. I feel very motivated.
Then I would suggest that you didn't do EVERYTHING totally the same.
when i typed elif it said invalid syntax
Please post the code somewhere so I can see it. Clearly it has an error in it, but you need to provide more info.
@@GaryExplains never mind, i had it like this
running = False
elif guess < n:
instead of this
running = False
elif guess < n:
Can I use this tutorial to help me hack any account . Including deleted instagram?
I'm studying C++ language, and I've gotta say python is way similar to C++
Should have began by outputting "Do you want to play a game?"
my dad is making me code so far not bad
I'm totally new to this and I don't even know how to go about it 😐
I thought that is why I made the video, to teach you the steps.
I was not able to follow
i see python
i panic++
How to make a programming language.........
I highly recommend this book on the subject: interpreterbook.com/
Gary Explains thank you very much........
Abinash Pal blog.mgechev.com/2017/09/16/developing-simple-interpreter-transpiler-compiler-tutorial/ you can write a interpreter and compiler In 25 lines of javascript :)
Rafael Milewski thank you very much.......
WHY 9 IS ANSWER
It is random number that the program generated and the user needs to guess it.
Can we change program's generated number
By the way sir thanks for reply
It is a random number between 1 and 10, that is what this line sets: n = random.randint(1,10)
Would you like to see some of my python programs ranging from a text based calculator to a GUI Tkinter calculator and a game in pygame. I also have a program that can teach you how to use arrays which are VERY useful for more advanced programs :)
he has 666 likes lol
Gary knows his stuff. He is undoubtedly a Tech expert. However he just rushed through the fundamentals of programming way too fast in this video. He barely explained everything. If you know about programming this video won’t be of any use to you. If you don’t know anything about programming you won’t understand what he is saying. Who exactly was this video for?
Steve, I agree with everything you say if this was meant to be a step by step tutorial. But my aim was to show people that it is easy to get started and how easy it is to write your first program. After that you will need to put in some effort yourself. Also I wanted to judge the demand for programming tutorials and the demand for Python tutorials.
Gary Explains Personally as someone who is presently slowly learning programming this video would have put me off six or 12 months ago. I do think a Python learning series would be a good idea. My initial reaction when I saw your video emerge on CZcams was great. However when you flew through the video with nary an explanation my enthusiasm waned. I get your point that this was not meant to be a tutorial. However what I suggest is that if you do want to do a series on Python you want have to start at the very beginning and that means explaining what a variable is, datatypes, strings, etc. All the boring beginner stuff that newbies have to become comfortable with before they can even begin to start working with functions and objects. Always assume that the person who you are teaching might not know anything you are talking about. It’s hard when you are standing on top of a mountain to see those at the bottom.
I respect you point of view and understand what you are saying, but as I said that wasn't the point of the video. Also I would suggest that "all the boring beginner stuff" isn't necessarily the best way to go about teaching people. An alternative approach is to get people actually up and running and achieving a result and then circle back to the beginner stuff, i.e. start with a win. I have written teaching books and developed an Android App development course (see dgitacademy.com) so I am very aware of what beginners need.
Gary Explains I hear what you are saying Gary. I will suspend judgement and wait and see what you come up with in regards a beginners Python course. I think it’s a good idea in principle. It’s only the implementation I had concerns about. Ok thats enough input for me for today.
Javascript is actually the language to go if you wanna start learning programing faster...
It might be faster to get started, but I wouldn't recommend it to a beginner at all.
Gary Explains your background might be in computer science, hardware etc... Naturally you may wanna have control over every single byte that is written / read from memory with precision etc... However learning javascript opens door for a much broad range of opportunities for the overall non high technical people who are looking only to make a living out as a developer... Nowadays the web community is so hot, you pretty much can deal with the whole dev stack in javascript itself... low-level understanding of 'real languages' is kind of no longer required anymore.. There is always a way to do anything in javascript opposed to python and the majority of the other languages. Certainly javascript is not the language for most of the tasks people are using it to.. But in the end it is so convinient, to have one language for the whole stack... That soon or later this will become the standard for everything... See all the efforts big companies like Google and Facebook does on allowing javascript for native mobile development... Or nodejs, or v8 team, or... U name it, you can even run javascript inside a microcontroller allowing anyone to write code that will run inside your fridge(IoT for example (it's worrying) but totally cool ...
Nonsense.
Gary Explains I think you just hate javascript as much as I hate java for no reason :)
I can assure you it isn't for no reason! ;-)