0
Python Core Task 28
Please explain logic of this code without “brake”, why it works like it works) https://code.sololearn.com/cRIj1e8yJe41/?ref=app
13 Answers
+ 4
🙁 you should tell that clearly..!!
If you need with loop then
for I in lis:
print( i, end="")
Or
print([*range(first_year ,last_year)])
+ 3
You are making a date picker for a website and need to output all the years in a given period.
Write a program that takes two integers as input and outputs the range of numbers between the two inputs as a list.
The output sequence should start with the first input number and end with the second input number, without including it.
Sample Input
2005
2011
Sample Output
[2005, 2006, 2007, 2008, 2009, 2010]
b = int(input())
e = int(input())
# your code goes here
+ 2
Ivan Horlenko ,
following the task description, we do not need to use a loop for output:
strt = int(input())
end = int(input())
print(list(range(strt, end)))
+ 1
You asked explanation about code working.. I added.
You are not mentioned what is task anywhere..!
So can you say what is actually your task there? What is expected output? Is it code coach problem?
0
Ivan Horlenko
You are making a list of range first_year, second_year and just prining list.
With loop, just print list in one iteration with break.
Without break, it print list the number of times of length of list.
Hope it helps..
edit:
are you trying to print list items by loop..?
0
Its still hard for understanding. How can i did this task with loop?
0
What is the task? Add description here..
0
Ok, are there any other ways to solve this task?
0
Cmon guys. I understood what Ive done. Im trying to know other ways to solve this task.
0
a = int(input())
b = int(input())
print(list(range(a, b)))
0
You are making a list of range first_year, second_year and just prining list.
With loop, just print list in one iteration with break.
Without break, it print list the number of times of length of list.
Hope it helps..
print(list(range(a, b)))
0
a = int(input())
b = int(input())
#your code goes here
num=list(range(a,b))
print(num)