Writing a Python Program – Simple Workflow

This 14-minute demo shows how to use two terminal windows to write and debug a simple Python program.

Comments

Noah K says:

wouldn’t it also be possible to call the function main() again if the number is not correct? Then it would start the program over and over again if the number wasn’t found

Ryan N says:

great video thank you so much! really helped me improve upon several programs I had just getting the workflow right

Bi Ao says:

I don’t understand
————————————————–
if __name__==’ __main__ ‘ :
main( )
————————————————–
Can someone describe this pls?

Nandish V Patel says:

Perfect! Best intro ever – not just ‘Hello World’ and then techno maze. Thanks from London!

Nitro says:

richard i really wanna be like you im your biggest fan

Demetrio Cumplido says:

Hello Friend. How did you get your code to have color?

Ford Ford says:

Thank you

MUHAMMAD USMAN says:

How did you save it to the memory at 2:35? thanks

Dakota Lewis says:

For the three quotation marks, I have heard several people say that it is used as comments but isn’t actually a comment because it gets read by the system but immediately garbage collected, whereas pound signs get completely ignored…. I’m just learning but was wondering if it really makes a big impact?

vern funnell says:

Really helpful!

Jeremy Forrest says:

I’m currently taking lessons on Sololearn, about halfway through, but still new to python. My question, why define a function, just to call it once, wouldn’t the program run just as fine if it wasn’t contain in a function. It seems a bit pointless.

Burak Sümer says:

I did this on my own after writing it i checked all codes my program does not close after guessing the number. What could be the problem?

Suhas HE says:

Really Good and informative videos

Gorlung says:

wow, I’ve wrote my first program using Python and it is not “hello world!”

I let the computer to play with itself and guess the number, calculating the number of attepmts

from random import randint
def main():
randomNumber = randint(0, 100)
randomGuess = randint(0, 100)
attempt = 0
while randomGuess != randomNumber:
attempt += 1
randomGuess = randint(0, 100)
randomNumber = randint(0, 100)
else:
print(‘Found! Number of attempts: ‘ + str(attempt))
main()

Dakota Lewis says:

Quick question: Why create the variable “found” instead of simply doing “while true” around the applicable code and “return False” under the if statement?

Bishchips says:

Thanks Richard, this was good. You inspired me to believe how easy it is to learn Python …

Gerard MB Pean says:

This really helped. Please make some more. I’m a beginner and I finally understand the elif, while, if and else.

ROHIT SHARMA says:

thank you for sharing

Shortcut says:

love python,absolutely fell head over heels for the language.

Hype Tutorials says:

Great Tutorial – thanks Richard

Jonathan Fibonojji says:

great video. Thank you.

L G says:

Very good tutorial with clear explanations!

Shiny Psyduck says:

it’s all good and game but how do i use this to make a video game?

jahangir sufi says:

absolutely amazing!!

- Eth says:

What color scheme does your vim editor have?

Enrique Ruijs says:

wow thanks 🙂

Jean-Marie NGOK says:

One of the best python tutorial I ever watched. The workflow process is so captivating. Kudos Mr White..

John Newburn says:

In python 3.5 it keeps syntax erroring at first randomNumber:

Babu says:

Are we still living in the era of “Hello World”..??????

Budheswar Baghel says:

how i highlight the current line in vim?

Th T says:

I typed this:

elif userGuess > randomNumber: #If the guess is higher than the number

and got this error:

TypeError: ‘>’ not supported between instances of ‘str’ and ‘int’

any ideas?

mostafa nasser says:

I want to learn python but after watching this i think i am stuck … after “hello world” stuff what should i do gradually? All tutorials are for very beginners or for professionals nothing in between any help?

Hamid Jalili says:

You are absolutely a great teacher!  Thanks!!!

John Birch says:

I know this video is from 5 years ago, but the ‘if __name__ = “__main__”: function is not required in this type of program. That is only needed when you are importing a custom made class from a different python program.

Rebeca Moraes says:

This is so cool

Kathleen Munro says:

I’m wondering what exact program he’s using. I’m very interested

dashan Zhang says:

Thanks .I like this!haha!

TheRealConservative says:

Love your around the world in 80 days reference

Panda Modz says:

when i type vi guesser.py it does not come up with the 1? just a bunch of ~

Nikola Semjanov says:

“__name__” == “__main__”:

what does this exactly mean?

Evangelus195 says:

UOOOT NO SEMICOLONS?

Frank Sinatra says:

nicely done!! I like the build as we go approach. Thanks!

ahmad hakimi says:

What kind of application that your used for coding ???

Dark 5555 says:

What app are u using?

Zut Zutalors says:

Excellent tutorial. Thanks for not filling half of it with you CV, and not having dumb ugly music drowning out your commentary.

Purple ヤシの木 says:

when i realize he was that badass at 2k12 n now its 2k17 n he got more skills rn *cryin immediately*

zach p says:

loved this video! 10:30 keyboard bongo lol

Zizi Arkaan says:

i got infinite loop of Guess Higher! How do you fix this?

- E-SoFa - says:

can some body help me? i ‘m doing a Calculator an i wan’t after its Calculated that you can do it again without writing The same thing again.

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!