+ 1
Why is while True here?
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2436/
18 odpowiedzi
+ 12
It is there to loop through its contents *forever*. It is called an infinite loop, as its condition will be always True. In order to exit from it, you have to use break or exit().
+ 5
Well, if you want your program to stop working immediately - yes, you can. Break just exits the local block of code, like loop for example. While exit() terminates the program and exits to the system.
+ 4
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 It basically terminates the script.
+ 4
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 You might want to bookmark the thread below and check out the link which is marked as best there, by David Ashton.
https://books.goalkicker.com/PythonBook/
https://www.sololearn.com/discuss/444755/?ref=app
+ 3
while True:
is there so that it will repeat again and again from start to end until break breaks the loop;)
+ 3
while True means loop forever. The while statement takes an expression and executes the loop body while the expression evaluates to (boolean) "true". True always evaluates to boolean "true" and thus executes the loop body indefinitely. It's an idiom that you'll just get used to eventually
+ 2
Because there is no any base condition to terminate the while loop .So, it will execute the block of statements upto infinite times but you can terminate it with a break statement at the end of your program.If this might helped you give me 5 upvotes bro !
+ 2
We use a ^while True^ to loop through what it contains forever. We call it an infinite loop(But you can exit from it using break or exit()).I hope you understand it. If you liked this answer please upvote it .
+ 2
Its there for continuous execution the part of code. In the mention code the user can do continuous calculation by taking input from user until the input is equal to quit ( there will be break which will break infinity loop).
+ 1
Code Crasher A coding way to do that, would be to create your own web code with links to your favourite threads bookmarked ;)
+ 1
no
+ 1
While loops go through a statement until it's false. If if u just put true the thing would on forever
+ 1
For infinity time excess of calculate
+ 1
So that the loop can execute at least one time.
+ 1
Because loop excute when it is break
+ 1
Could it be True for the power button of the calculator. And the infinity loop.
+ 1
While basically works only when the condition becomes true. In this scenario it will helps to iterate infinite number of times.The program will iterate from start to end until it encounters break statement
0
Bonjour