Python Tutorial - 8. If Statement

preview_player
Показать описание
The video will describe “if” statement in python, “if control” statement, the use of “if” statement, how to create “if” statement and the flow of “if” statement.

Topics that are covered in this Python Video:
0:00 Introduction
1:32 input() function
2:13 int() function
6:34 Operators

Next Video:

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

nice video ! you deserve a samosa plate for this awesome video and especially the background music :)

debk
Автор

usa=['atlanta', 'new york', 'chicago', 'baltimore']
uk=['london', 'bristol', 'cambridge']
india = ['mumbai', 'delhi', 'bangalore']


1)cnt=input('Enter the city:')
if cnt in usa:
print('its in Us')
elif cnt in uk:
print('its in uk')
elif cnt in india:
print('its in india')
else:
print('No Idea!!')




2)ent1=input('enter 1st city:')
ent2=input('enter 2nd city:')
if ent1 in usa and ent2 in usa:
print('both are in usa')
elif ent1 in uk and ent2 in uk:
print('both are in uk')
elif ent1 in india and ent2 in india:
print('both are in india')
else:
print('No Idea!!')

pavi_n_baby
Автор

and.. the music??? dont forget the music ! ... Thanks very good this video.. thank again !
( I am a Peruvian bigenner student)

LuisMan
Автор

Make videos on Machine Learning with Python please.. Also record the video in higher sound quality. Sound is not so good. Thank you.

flamboyantperson
Автор

usa=["atlanta", "new york", "chicago", "baltimore"]
uk=["london", "bristol", "cambridge"]
india=["mumbai", "delhi", "banglore"]
city1=str(input("Enter a first city name : "))
city2=str(input("Enter a second city name : "))

if city1 and city2 in usa :
print (city1+" and "+city2+" belong to usa")
elif city1 and city2 in uk:
print(city1+" and "+city2+" belong to uk")
elif city1 and city2 in india:
print(city1+" and "+city2+" belong to india")
else:
print('Entered cities located in different countries ...')

for last assignment i wrote this program but it is not run correctly, please correct it for me

mohamedsherif
Автор

Can you help me?, please..

Why does not it run?

usa=["atlanta", "new york", "chicago", "baltimore"]
uk=["londo", "bristol", "cambrige"]
india=["mumbai", "delhi", "banglore"]
a=input("Enter city one: ")
b=input("Enter city two: ")
city=[]
city+=[a, b]
if city in usa:
print("Yours countrys are in USA")
elif city in uk:
print("Yours countrys are in uk")
elif city in india:
print("yours countries are in india")
else:
print("I have to say that they both citys ", city, "arent belong the same country")



LuisMan