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?
7 Réponses
+ 6
Gints Usackis , may be can show us your code, also the task description. This makes it easier to help. Thanks!
+ 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!
+ 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
+ 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]
0
Thanks!
0
a = int(input())
b = int(input())
c = []
for i in range(a, b):
c.append(i)
print(c)
- 1
and there is 4 test cases which i need to write in one code