0

casted 2 int yet float value is given

list = [1,2,3,4,5,6] print(list) hlf = (len(list)/2) int(hlf) print(hlf) i = list[ 0:hlf] j = list[ hlf:6] print(i,'\n',j) #hlf value is shown as 3.0

16th Sep 2017, 5:10 AM
Abishek Robin
Abishek Robin - avatar
2 Réponses
+ 3
You casted the value, but didn't save it back to the variable. hlf = int(hlf)
16th Sep 2017, 5:14 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
tq mate !
16th Sep 2017, 5:15 AM
Abishek Robin
Abishek Robin - avatar