Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 197 Bytes

File metadata and controls

23 lines (18 loc) · 197 Bytes

If True

Improve the following block of code:

y = 0
x = False

if x == True:
    y = y + 1
if x == False:
    y = y + 2

Solution

x = False
if x:
    y = 1
else:
    y = 2