What will be output of following code X=2
For X in range (2,20+2,+2):
Print (X)
Answers
Answered by
4
Answer:
count = 0
while count < 10:
print("Welcome to Python")
count += 1
A. 8
B. 9
C. 10
D. 11
E. 0
5.2 What is the output of the following code?
x = 0
while x < 4:
x = x + 1
print("x is", x)
A. x is 0
B. x is 1
C. x is 2
D. x is 3
E. x is 4
Answered by
1
In this question there is syntax firstly we have to correct the syntax error that is in for must be in small and print statement is small after removing the syntax error the output is:2,4,6,8,10,12,14,16,18,20
Explanation:
Following are the description of output
- As mention the value of x variable is 2 .It means it is initialized with the value 2.
- For loop is iterating this for loop is started with the value 2 and iterated up to the less then 22 .
- Their is always + 2 increment statement is there it means in every iteration the value of x is incremented by 2 .
- their is print(x) statement inside the loop which is used for print the value in the console .
- So firstly 2 is printed then after incrementing the value of x is 4 Checking the condition 4 < 22 condition is true 4 is display and soon...
Learn More :
https://brainly.com/question/15062363
Similar questions