Computer Science, asked by snilewar1998, 9 months ago

for i in range(2):
print(i,end="")

for i in range(4,6):
print(i,end="" )

Answers

Answered by LuckyYadav2578
1

Output

for i in range(2):

print(i,end="")

The output will be

  • 01

About the above programme

  • Its range is from 0 to 1
  • you have given only ending index that is 2 i.e by default it will start from 0 and end at 1 less then one from the end index.
  • in 'end' you have not given any space and because of that the output will have no space
  • 'end' is to make the cursor in the same line

for i in range(4,6):

print(i,end="" )

The output will be

  • 45

About the above programme

  • Its range is from 4 to 5
  • you have given ending as well as starting index, starting index is 4 ending index is 6 i.e its range will be from 4 to 5 less then one from the end index.
  • In 'end' you have not given any space and because of that the output will have no space
  • 'end' is to make the cursor in the same line
Similar questions