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

7th May 2022, 6:37 PM
Ivan Horlenko
13 ответов
+ 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)])
8th May 2022, 10:52 AM
Jayakrishna 🇮🇳
+ 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
8th May 2022, 4:33 AM
BroFar
BroFar - avatar
+ 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)))
8th May 2022, 2:43 PM
Lothar
Lothar - avatar
+ 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?
7th May 2022, 8:15 PM
Jayakrishna 🇮🇳
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..?
7th May 2022, 6:51 PM
Jayakrishna 🇮🇳
0
Its still hard for understanding. How can i did this task with loop?
7th May 2022, 7:19 PM
Ivan Horlenko
0
What is the task? Add description here..
7th May 2022, 7:23 PM
Jayakrishna 🇮🇳
0
Ok, are there any other ways to solve this task?
7th May 2022, 7:56 PM
Ivan Horlenko
0
Cmon guys. I understood what Ive done. Im trying to know other ways to solve this task.
8th May 2022, 9:22 AM
Ivan Horlenko
0
a = int(input()) b = int(input()) print(list(range(a, b)))
21st Jun 2022, 3:16 PM
Андрей
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)))
9th Aug 2022, 8:31 PM
Yasir Shaikh
Yasir Shaikh - avatar
0
a = int(input()) b = int(input()) #your code goes here num=list(range(a,b)) print(num)
4th Mar 2023, 7:31 PM
Borico Okomo Nguema
Borico Okomo Nguema - avatar