Conditional if structure

Summary

Share a clear and concise description of the issue. Aim for 2-3 sentences.
I am trying to use the conditional if structure but the code returns invalid syntax.

Steps to reproduce

Code snippet:

add code here
```st.sidebar.header('Enter Details')
CIF_USD = st.sidebar.number_input ('Enter CIF in USD', value=0)
cc = ['1500cc and below', 'Above 1500cc']
car = st.sidebar.selectbox('Engine size', cc)
st.sidebar.write('1USD = 128 KES')
FX = 128
CIF_KES = CIF_USD * FX
st.sidebar.write('CIF in KES :    ' + str(CIF_KES))

#..excise duty.....
a=0.20
b=0.25
def excise_duty():
    if car = Above 1500cc:
        return CIF_KES*b
    else:
        return CIF_KES*a
excise_duty

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

**Expected behavior:**

Explain what you expect to happen when you run the code above.
I expect the code to return excise duty of 20% of the CIF if the vehicle is 1500cc and below and 25% if the vehicle is 1800cc and above
**Actual behavior:**

Explain the undesired behavior or error you see when you run the code above.
If you're seeing an error message, share the full contents of the error message here.
The code returns invalid syntax
### Debug info

- Streamlit version: (get it with `$ streamlit version`)
- Python version: (get it with `$ python --version`)
- Using Conda? PipEnv? PyEnv? Pex?
- OS version:
- Browser version:

### Requirements file

Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out [this doc](https://docs.streamlit.io/streamlit-cloud/get-started/deploy-an-app/app-dependencies) and add a requirements file to your app.

### Links

* Link to your GitHub repo:
* Link to your deployed app:

### Additional information

If needed, add any other context about the problem here.

Hi @Dennis, have you tried looking up the correct syntax for python if statements? For example, 4. More Control Flow Tools — Python 3.11.1 documentation

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.