0

Python List Functions

items = [2, 4, 6, 8, 10, 12, 14] num = len(items) \\ 2 print(num) It says that there's an unexpected character in the third line. Can anyone explain?

22nd Jun 2022, 4:54 PM
Ayesha Tajalli
2 odpowiedzi
+ 6
Ayesha Tajalli , it should be: num = len(items) // 2 # this an integer division that returns a whole number
22nd Jun 2022, 5:03 PM
Lothar
Lothar - avatar
+ 1
Ah I understand! Thank you<3
22nd Jun 2022, 7:19 PM
Ayesha Tajalli