I find a bug of python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

I find a bug of python

list = [1,3,4] a = list(range(10)) If i use "int","float","list"... to name a variable,it Will report an error

5th Sep 2019, 11:36 AM
Wang HaiTao
1 Answer
+ 5
You're redefining the list() function to [1,3,4], so calling "list" will call [1,3,4] instead of your old list() function. That's why it's not recommended to use functions/methods/reseved keywords (e.g. int, float, list) as variable names. It can mess up your code.
5th Sep 2019, 12:00 PM
Diego
Diego - avatar