0

Whats wrong with this please help

from itertools import accumulate, takewhile def ui(): x = 0 while x <= 6: return True nums = list(accumulate(range(8))) print(nums) print(list(takewhile(ui(), nums))) Lesson says while a function returns true Please explain and correct me😁

21st Oct 2021, 4:54 PM
Abdul Manan Jutt
Abdul Manan Jutt - avatar
1 Resposta
+ 1
Abdul Manan Jutt x is input for ui from itertools import accumulate, takewhile def ui(x): # x will be parameter to ui # x = 0 while x <= 6: return True nums = list(accumulate(range(8))) print(nums) print(list(takewhile(ui, nums))) # function name without ()
21st Oct 2021, 7:04 PM
Sushil 🛡️
Sushil 🛡️ - avatar