File tree Expand file tree Collapse file tree 6 files changed +32
-10
lines changed
Expand file tree Collapse file tree 6 files changed +32
-10
lines changed Original file line number Diff line number Diff line change 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 number Diff line number Diff line change 33second_number = input ("Second input" )
44third_number = input ("Third input" )
55# print here the sum of three inputs
6+
7+ print (first_number + second_number )
Original file line number Diff line number Diff 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 .patch ('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' )
1221def 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 .patch ('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 number Diff line number Diff line change 11# ` 21 ` Factorial
22
3+ ## 📝 Instructions
4+
35Write a program which can compute the factorial of a given numbers.
46The results should be printed in a comma-separated sequence on a single line.
57Suppose the following input is supplied to the program:
8+
9+ ``` bash
6108
11+ ```
12+
713Then, the output should be:
14+
15+ ``` bash
81640320
17+ ```
18+
19+ ## 💡Hints:
920
10- Hints:
1121In case of input data being supplied to the question, it should be assumed to be a console input.
Original file line number Diff line number Diff line change 1+ # Your code here
Original file line number Diff line number Diff 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 ())
77print fact (x )
You can’t perform that action at this time.
0 commit comments