If, Then, Else in Python || Python Tutorial || Learn Python Programming

preview_player
Показать описание
To learn Python, start our Python Playlist HERE:

♦♦♦♦♦♦♦♦♦♦

We recommend:
Python Cookbook, Third edition from O’Reilly

The Mythical Man Month - Essays on Software Engineering & Project Management

Shop Amazon Used Textbooks - Save up to 90%

♦♦♦♦♦♦♦♦♦♦

Ways to support our channel:

► We also accept Bitcoin @ 1EttYyGwJmpy9bLY2UcmEqMJuBfaZ1HdG9

Thank you!

♦♦♦♦♦♦♦♦♦♦

Connect with us!

♦♦♦♦♦♦♦♦♦♦

Python instructor: Ulka Simone Mohanty
Written & Produced by Michael Harrison
FX by Andriy Kostyuk

♦♦♦♦♦♦♦♦♦♦
Рекомендации по теме
Комментарии
Автор

In python 3, you should use: a = input("Your text here.")
In python 2, you should use: a = raw_input("Your text here.")

SMFahim-vozn
Автор

It's official! The Socratica Python Kickstarter was a success! Thank you to all of our supporters. Because of you, many more Python videos coming soon!! 💜🦉

Socratica
Автор

"If... you want to learn more, then...." So clever. I am donating to your cause. Great videos.

stephenhobbs
Автор

i like that.... If you want to learn more; Then continue; Else watch next video.
Applaud!

fikeysparrow
Автор

I love the presentation style of this video! It's so cool!

Houram
Автор

just my 2 cents for those stuck in 1:33 and using python 3.
a = input("Please enter a test string: ")

if len(a) < 6:
print("Your string is too short.")
print("Please enter a string with at least 6 characters.")

bushwhack
Автор

Python 3 version:

#if_then.py
# Collect string / test length

testinput = input("Please enter a test string: ")

if len(testinput) < 6:
print("Your string is too short.")
print("Please enter a string with at least 6 characters.")

#if_then_2.py
# Prompt user to enter a number / test if even or odd

testinput = input("Please enter an integer: ")
number = int(testinput)

if number % 2 == 0:
print("Your number is even.")
else:
print("Your number is odd.")

#if_then_3.py
# Scalene triangle: All sides have different lengths
# Isosceles triangle: Two sides have the same length
# Equilateral triangle: All sides are equal

a = int(input("The length of side a = "))
b = int(input("The length of side b = "))
c = int(input("The length of side c = "))

if a!= b and b != c and a != c:
print("This is a scalene triangle.")
elif a == b and b == c:
print("This is an equilateral triangle.")
else:
print("This is an isosceles triangle.")

slwayne
Автор

*New Python video! IF you'd like to see it, THEN click here. OR ELSE:*

 
#LearnMore #python

Socratica
Автор

This is the first video I ever come across of such way of teaching languages, Awesome !!!you are great!

santoshshinde
Автор

You saying "there is no limit" at 5:20 is just a treat.

pmflanigen
Автор

Note that in python 3, You should use: input = input("Your text here:")
I assure u that it will work. u re welcome.

dontme
Автор

If each two sides' length sum is found to be larger than the third, and if the different between each two sides is smaller than the third side, the triangle can exist.
The numbers should be positive for this. (a+b > c, a-b < c) for each side. could also check with trigonometry to find sum of angles and see if they add up to pi or 180 deg, but this can be somewhat complicated.

rotemlv
Автор

This video drags me to the center point of a good decision maker.
Fork is what problem solvers encounters in each miles.
This is the best presentation so far ive encounter.


ezekielakusos
Автор

Just 1 comment: in computer programming, it is advisable not to use reserved keywords or built-functions for variable names. "input" is a keyword in Python, so, perhaps a different variable name would be better.

shobharoy
Автор

Hello all,
raw_input is for python 2.x. In python 3.x it occures in a name error.
Here we have to use only "input" ;)

annaj.
Автор

I do really like your style in making a python tutorials. They are all informative!

alfiecanta
Автор

to test for proper triangle a = int(raw_input("The length of side a = "))
b = int(raw_input("The length of side b = "))
c = int(raw_input("The length of side c = "))

if c < a + b and c > max(a, b) - min(a, b):
if a != b and b != c and a != c:
print('This is a scalene triangle (all different lengths).')
elif a == b and b == c:
print('This is an equilateral triangle.')
else:
print('This is an isosceles triangle.')

else:
print(" This is not a propper triangle, Try again please.")

noel
Автор

I like how you teach. You are fun. “If” you start: you are funny. “Elif” you are in the middle of the vid: you are serious. “Else” : you are always hilarious. :) 😂

blackwhite
Автор

have a question i made a fille and typed the right command but it just keeps saying vim is not reconized as a internal or external command 0:30

matteo
Автор

This is super flashy and cool, I don't know if it's my noobness to coding, or the outdatedness of the material that is putting up way too many roadblocks to progress here, I think I'm going to put a pause on this series, and come back when I know enough to properly correct myself. I'm afraid I'll quit all-together if I keep going this route.

trysmarter
welcome to shbcf.ru