0

Can anyone write me the full code of below code?

while True: print("This statement will run endlessly") print("This statement will also run endlessly") I need the full code of it so that it runs.

2nd Aug 2020, 6:14 AM
RH Tasin
RH Tasin - avatar
4 ответов
+ 1
RH Tasin python while loop checks that given condition returns true or not. If it return true then loop starts, if it is false then it doesn't run. It like python checks boolean value of given conditions. As True(not true) will return True on boolean test. So it runs.
5th Aug 2020, 10:31 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 1
RH Tasin True is python keyword that is used for checking true conditions. Lets take a example n=2 if n%2==0: print('even') In this python checks boolean value for given condition. If you run this [print(n%2==0)] it will print True means your condition is if n%2==0 will equal to if True Check this code for true values. I used bool function whic is used to return true/false on based on given value https://code.sololearn.com/coAaE3H9U9Vh/?ref=app check that last value in the list in given code it is storing as True not 4%2==0 hope it will help🙂
5th Aug 2020, 11:33 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
0
AKSHAY but I haven’t set any condition here. So how is it working?
5th Aug 2020, 3:31 AM
RH Tasin
RH Tasin - avatar
0
AKSHAY what is the condition in this code? I have just written "while True". But what is true here? How python knows it’s really true or false? Because here is no condition.
5th Aug 2020, 11:20 AM
RH Tasin
RH Tasin - avatar