+ 6

x=0 i=0 while i<4: x+=i i+=1 print (x)

When I run this code in python. The output show 6 as I tell to print (x) .Will anyone tell me in details that why this code print 6 .

11th Apr 2022, 11:48 AM
Hemant Kumbhalkar
Hemant Kumbhalkar - avatar
4 ответов
+ 5
x => 0+1+2+3
11th Apr 2022, 11:49 AM
Jayakrishna 🇮🇳
+ 4
Thanks
11th Apr 2022, 11:51 AM
Hemant Kumbhalkar
Hemant Kumbhalkar - avatar
+ 3
X=0+1+2+3=6
30th Jun 2022, 9:18 AM
Sunil Kumar Sahu
Sunil Kumar Sahu - avatar
+ 1
Hope it's clear.. You're welcome
11th Apr 2022, 11:56 AM
Jayakrishna 🇮🇳