Quote
AttributeError: 'float' object has no attribute 'split'
This error is quite clear. mynum is a number, you know this as you used float() to create the number, and a number doesn't have a split() method. A string does so you can use str() in the same way you used float().
In Javascript, splitting on the empty string "" will split a word into individual characters. This is useful and I'm not sure of another language that does this. However, Python doesn't, and you'll receive an error. But you don't need to do this because a Python string is already a sequence:
x, y, z = "123"
Of course, you should only do this if you know that there are exactly three characters/digits.

New Topic/Question
Reply



MultiQuote

|