Computer Science, asked by janiya43, 9 months ago

x= 100
y=10
for i in range (5)
X=X - 20
y=y *2
c=x + y
print (x)
print (y)
print (c)
print (y **x)
print (y%c)
Your answer

Answers

Answered by misbahrehman2008
0

Explanation:

Python 2, 'print' is not a function, it is a statement. You will understand about functions in later chapters.

Let's see some more examples:

Python 2 Python 3

print("Hey! I am an upcoming coder")

print("I am going to step into world of programming")

Output

Hey! I am an upcoming coder

I am going to step into world of programming

Python 2 Python 3

print("I am loving this. Print, print and print!")

Output

I am loving this. Print, print and print!

Let's do something more advanced.

Python 2 Python 3

x = 10

y = 5

print("sum of",x,"and",y,"is",x+y)

Output

sum of 10 and 5 is 15

Here, x = 10 means that we are taking a variable x and giving it a value of 10.

y = 5 → Similar to x = 10, y is variable which is assigned a value of 5.

print("sum of",x,"and",y,"is",x+y) → Take a note that "sum of", "and" and "is" are written inside " " but x, y and x+y are not and these are seperated using commas (,).

Whatever we write inside " " or ' ' gets printed as it is and is not evaluated. So, 'Sum of', 'and' and 'is' got printed as it is. But x, y and x+y are not written inside ' ' or " ", so they are variables and the complier will use their value. That's why the value of x got printed (i.e., 10).

Similarly, the value of y (i.e., 5) got printed and at last, the value of x+y got calculated (i.e., 15) and got printed.

Similar questions