+ 3

How to end a if statements in python

python

28th Aug 2018, 9:10 AM
Chaim
Chaim - avatar
5 Respostas
+ 6
Python 'if' block is built with indentation, simply reduce the indentation level of the next instruction line to put it out of the block. year = 2018 if year == 2018: # code in 'if' block codes # last line in 'if' block print(year) # 'if' block ends above
28th Aug 2018, 9:38 AM
Ipang
+ 4
Python usa espacios para diferenciar lo que esta dentro deñ if de lo que esta afuera if True: #Esto esta adentro #Esto esta adentro #Esto esta afuera
28th Aug 2018, 12:01 PM
URROVA
URROVA - avatar
+ 3
if a == b: print("a is equal to b") elif a > b: print("a is larger than b") else: print("a is smaller than b")
29th Aug 2018, 1:14 AM
Intelligent Net
Intelligent Net - avatar
+ 1
if x = 0: #in if statement #not in if statement
4th Sep 2018, 11:20 AM
Tygo
Tygo  - avatar
0
it runs and eventually stops when its done with indented content. or are you looking for else: # do something pass
28th Aug 2018, 9:38 AM
Markus Kaleton
Markus Kaleton - avatar