Предмет: Информатика, автор: aoaoaramato

What is the output of the following
code?x=5 while x>=0: print (x) if
x=="1": print ("Blast off!") x=x-1*​

Ответы

Автор ответа: Аноним
6

Ответ:

5 4 3 2 1 Blast off! 0

Объяснение:

x = 5

x >= 0 ? - Yes, so we print 5.   x == 1? No.  x = x - 1 = 5 - 1 = 4.

x = 4

x >= 0 ? - Yes, so we print 4. x == 1? No. x = x - 1 = 4 - 1 = 3

x = 3

x >= 0 ? - Yes, so we print 3. x == 1? No. x = 3 - 1 = 3 - 1 = 2

x = 2

x >= 0 ? - Yes, so we print 2. x == 1? No. x = x - 1 = 2 - 1 = 1

x = 1

x >= 0 ? - Yes, so we print 1. x == 1? Yes, so we print "Blast off!". x = 1=x - 1 = 1 - 1 = 0

x = 0

x >= 0 ? - Yes, so we print 0. x == 1? No. x = x - 1 = 0 - 1 = -1

x = -1

x >= 0? - No

Похожие вопросы
Предмет: Математика, автор: niiy