18 Réponses
+ 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().
26th May 2020, 12:33 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 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.
26th May 2020, 1:41 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 It basically terminates the script.
26th May 2020, 1:37 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 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
26th May 2020, 1:48 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
while True: is there so that it will repeat again and again from start to end until break breaks the loop;)
26th May 2020, 5:56 PM
ROHIT PRADHAN
ROHIT PRADHAN - avatar
+ 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
27th May 2020, 1:40 PM
Nidhi Verma
+ 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 !
27th May 2020, 9:11 AM
Ashwini Burnwal
Ashwini Burnwal - avatar
+ 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 .
27th May 2020, 11:25 AM
Taha Lyousfi
+ 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).
28th May 2020, 5:14 AM
Rahul Gupta
Rahul Gupta - avatar
+ 1
Code Crasher A coding way to do that, would be to create your own web code with links to your favourite threads bookmarked ;)
26th May 2020, 3:02 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
no
27th May 2020, 8:36 PM
Gurseerit Singh Chahal ✓
Gurseerit Singh Chahal ✓ - avatar
+ 1
While loops go through a statement until it's false. If if u just put true the thing would on forever
28th May 2020, 2:11 AM
Mason Arb
Mason Arb - avatar
+ 1
For infinity time excess of calculate
28th May 2020, 4:55 AM
Aashutosh Sharma
Aashutosh Sharma - avatar
+ 1
So that the loop can execute at least one time.
28th May 2020, 7:24 AM
Aditya
Aditya - avatar
+ 1
Because loop excute when it is break
28th May 2020, 8:49 AM
Dheeraj C. Patil
Dheeraj C. Patil - avatar
+ 1
Could it be True for the power button of the calculator. And the infinity loop.
28th May 2020, 10:08 AM
eduardo palou jaume
eduardo palou jaume - avatar
+ 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
28th May 2020, 10:29 AM
Jai Ganesh Nagidi
Jai Ganesh Nagidi - avatar
0
Bonjour
28th May 2020, 12:26 PM
Malik Mfomboure officiel
Malik Mfomboure officiel - avatar