> For the complete documentation index, see [llms.txt](https://george-jen.gitbook.io/data-science-and-apache-spark/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://george-jen.gitbook.io/data-science-and-apache-spark/conditional-statement.md).

# Conditional statement

### Conditional statement

if \<condition>:

## True here

&#x20;   statements

elif \<condition>:

## True here

&#x20;   statements

…

else:

## Catch all other here

statements

Example:

```
key=input("enter key\n")
value=int(input("enter value\n"))
d={key:value}
if d['a']==1:
    print('yes')
elif d['a']==2:
    print('no')
else:
    print('unknown')

enter key
a
enter value
1
yes
```
