Control Structures - Python Basics 5/10

preview_player
Показать описание
This is video 5/10 in the Python Basics video series where I'll be talking about Control Structures.

Hope you enjoyed the video!

Check out this code here:

Join my Discord server to chat with me:

Check out some code on my GitHub:

Tweet me something funny on Twitter:

Say hi over at Facebook:

Sincerely,
Engineer Man
Рекомендации по теме
Комментарии
Автор

To all you guys who don't know what to write in the # while, i got the code for you here: PS: using python 3.7
# while
while age < 50:
print("not old enough, current age is " + str(age))
age += 1

Mark-xsys
Автор

Bad ass series man! Im a .net dev randomly learning python because you made it look fun in that video where you spammed that craigslist scammers site with bogus emails. Well done

Vnllabearable
Автор

Note:
In Python 2, the "print" statement is not a function, and therefore it is invoked without parentheses. However, in Python 3, it is a function, and must be invoked with parentheses. To print a string in Python 3, just write: print("This line will be printed.")

PezhvakIMV
Автор

Engineer man 2018 - "print child" 2:55

AJ
Автор

Really concise.

Grateful for the simplicity.

theunityofthejust-justifyi
Автор

so, if i want to increment age by 2, age +=2 which is basically age= age+2 right?

zakriaansari
Автор

How you tell the interpreter that e.g. line 19 is no longer part of the 'if' that began on line 14?

stan_stan-dk
Автор

Thanks Engineer Man! Been loving your videos. Thank you very much.

dutchboybmx
Автор

Hey brother the single dash ' ' are not working for strings

OutdoorCastIronCooking
Автор

Ternary statements and syntax learned. Thanks!

DireEntropy-Ramsey
Автор

Excellent videos so far! Though I think in the future you should be careful of your overlay in the corner of the screen -- I couldn't see what you typed on the last print line because it was blocked a bit!

g
Автор

Another thing: in this example you specify the value of age in the code. What if I want to let the user put it in? I remember in qbasic or gwbasic, instead of the "print" command, there was the "input" command. So instead of printing just: what is your age? it would print "what is your age?" and wait for user input after which it would start the comparisons.


Sooo...


print "What is your age?" would deliver:
What is your age?
on screen and then run through the other code. However:
input "What is your age"';A$ would deliver
What is your age? <insert blinking cursor here> that is waiting for input. The ;A$ did not need to be declared first *and* it would deliver the ? automatically, since it waited for input.


Is there a similar instruction in python that sort of behaves that way?

radiotriggered
Автор

Thanks man I love how you show this stuff very good teaching 👌🏻

wesleybarnes
Автор

Is there a when? like
when age = 50
Print 'old enough'
If not could I write a tool that I could call to use a "when" what would that look like

JD-ekod
Автор

are ternary if statements still in python 3 or were they removed or changed?

rajaminn
Автор

These videos are great - I've used python before, but have been using powershell now for so many years, this is a good refresher.. Only comment - the "light grey on black" is very hard to read.. might want to make a brighter color scheme for demos! Thanks!

SteveJonespilot
Автор

Do you tutor in python or recommend any online tutoring services?

TheEddieMayo
Автор

I'm curious, what did you write to get it to print what the age is while its counting up?

ftwgunnerpwns
Автор

instead of
old_enough = True if age >= 21 else False
you could write
  old_enough = age >=21
which is shorter

ugurata
Автор

What did you write on the end of 'Not old enough, current age Thanks :)

v
welcome to shbcf.ru