0

Python input()-or question.

Consider this code: for i in range(k): a = input() or 5 Suppose that there is no input given for this code (just pressing the enter button when the input prompt appears). If k is 1, a is equal to 5. However, if k is greater than 1, then EOFError is raised. Why does this happen, even though I had used the 'or' there?

5th May 2021, 7:19 PM
Calvin Thomas
Calvin Thomas - avatar
1 Odpowiedź
+ 1
Jan Markus Thanks for answering my question. I'll try it in PyDroid.
6th May 2021, 4:18 AM
Calvin Thomas
Calvin Thomas - avatar