File tree

6 files changed

+32
-10
lines changed

6 files changed

+32
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
__pycache__/
1616
.pytest_cache/
1717

18-
!/.breathecode
19-
/.breathecode/**
20-
!/.breathecode/resets
21-
!/.breathecode/resets/**
18+
!/.learn
19+
/.learn/**
20+
!/.learn/resets
21+
!/.learn/resets/**
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
second_number = input("Second input")
44
third_number = input("Third input")
55
# print here the sum of three inputs
6+
7+
print(first_number+second_number)
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,23 @@ def test_use_print():
88
regex = re.compile(r"print(\s)*\(")
99
assert bool(regex.search(content)) == True
1010

11+
@pytest.mark.it('Almost there! But you need to convert the incoming input from string to integer')
12+
def test_convert_inputs(capsys, app):
13+
14+
fake_input = ["2","3","4"] #fake input
15+
with mock.('builtins.input', lambda x: fake_input.pop()):
16+
app()
17+
captured = capsys.readouterr()
18+
assert captured.out != "432\n"
19+
1120
@pytest.mark.it('Sum all three input numbers and print on the console the result')
1221
def test_add_variables(capsys, app):
1322

14-
fake_input = [2,3,4] #fake input
23+
fake_input = ["2","3","4"] #fake input
1524
with mock.('builtins.input', lambda x: fake_input.pop()):
16-
app()
17-
captured = capsys.readouterr()
18-
assert captured.out == "9\n"
25+
app()
26+
captured = capsys.readouterr()
27+
assert captured.out == "9\n"
1928

2029

2130

Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
# `21` Factorial
22

3+
## 📝 Instructions
4+
35
Write a program which can compute the factorial of a given numbers.
46
The results should be printed in a comma-separated sequence on a single line.
57
Suppose the following input is supplied to the program:
8+
9+
```bash
610
8
11+
```
12+
713
Then, the output should be:
14+
15+
```bash
816
40320
17+
```
18+
19+
## 💡Hints:
920

10-
Hints:
1121
In case of input data being supplied to the question, it should be assumed to be a console input.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Your code here
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ def fact(x):
33
return 1
44
return x * fact(x - 1)
55

6-
x=int(raw_input())
6+
x=int(input())
77
print fact(x)

0 commit comments

Comments
 (0)