Doubt in Python

I have started learning python just today,so forgive me if the doubt which I am going to ask is silly.

I read that reserved keywords can’t be used as variables in python , but when i tried it with idle like

float = 3
print(float)

It was giving the output with no error. So I am confused whether above statement is right or wrong.Can someone help me out.

yes we can’t use reserved keyword as variable , but float is not a reserved keyword.

you can check using this

import keyword
print(keyword.kwlist)

2 Likes

Thanks mate