+ 1

Brackets In Python

Python has a very wide use for brackets from inputs to strings. It is all very confusing. How can I make sure that I am not mixing up wrong brackets in a practical problem where input is needed for calculations.

1st Sep 2021, 4:50 PM
Hack
Hack - avatar
2 Antworten
+ 2
You just need to remember that [ ] are used for lists, list comprehensions, indexing/lookup and slicing. Used for mutable data types.
1st Sep 2021, 5:00 PM
DavX
DavX - avatar
+ 1
Thank you I have just found a working code after some trial and error x = int(input()) y = int(input()) print(x+y)
1st Sep 2021, 5:06 PM
Hack
Hack - avatar