Python Test cases problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python Test cases problem

Hei. How can i pass all the test cases? I wrote a code for test case 1 and it's correct. If i edit the code for test case 2 it shows that test case 1 is wrong. How could i do (all 4 test cases) in one code?

11th Dec 2020, 3:16 PM
Gints Usackis
Gints Usackis - avatar
7 Answers
+ 6
Gints Usackis , may be can show us your code, also the task description. This makes it easier to help. Thanks!
11th Dec 2020, 4:06 PM
Lothar
Lothar - avatar
+ 6
Gints Usackis , this is a very basic task to solve: ▪︎use 2 input statements, and store the start year and the end year in 2 variables as integer values ▪︎to generate the output data you can use a for loop with range() function where you use the 2 variables as arguments ▪︎use a print() statement in the loop body to output the generated year number in each iteration happy coding!
14th Dec 2020, 10:01 AM
Lothar
Lothar - avatar
+ 3
you must use an input method and write the code so that it works for all tests at once, to do this, read the condition carefully. If after that it is not clear, write me the problem and I will explain
11th Dec 2020, 3:19 PM
Иван Чикyнов
Иван Чикyнов - avatar
+ 2
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]
12th Dec 2020, 10:53 AM
Gints Usackis
Gints Usackis - avatar
0
Thanks!
14th Dec 2020, 10:26 AM
Gints Usackis
Gints Usackis - avatar
0
a = int(input()) b = int(input()) c = [] for i in range(a, b): c.append(i) print(c)
20th Jun 2022, 11:22 PM
Андрей
- 1
and there is 4 test cases which i need to write in one code
12th Dec 2020, 11:10 AM
Gints Usackis
Gints Usackis - avatar