+ 1

How can I call tuples on my code?

I'm trying to do a calculator in Python, and I use a tuple for keep the signals, but when I did the condition for check if signal is in tuple, but it came this error "tuple is not callable". Also can I minimize this code, without leave the main functions Code: https://code.sololearn.com/c1HEHbmR01oO/?ref=app

21st Oct 2021, 11:53 PM
Katdotbrush
Katdotbrush - avatar
2 odpowiedzi
+ 3
Don't use round parentheses. Use square brakets instead. On line 16.
22nd Oct 2021, 12:20 AM
Stefanoo
Stefanoo - avatar
+ 1
As Stefanoo has stated, square brackets are used for indexing of iterables, including tuples. signals[0] Also, try changing the way the if condition reads to; if signal not in signals: The result is the same, but it is more Pythonic and readable.
22nd Oct 2021, 3:40 AM
ChaoticDawg
ChaoticDawg - avatar