File tree

68 files changed

+478
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searcx below for content that may be hidden.

68 files changed

+478
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ FROM gitpod/workspace-full:latest
44

55
USER gitpod
66

7-
RUN pip3 install pytest==4.4.2 pytest-testdox mock && npm i [email protected].5 -g
7+
RUN pip3 install pytest==4.4.2 pytest-testdox mock && npm i [email protected].52 -g
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# your code here
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def square(num):
2+
return num ** 2
3+
4+
print square(2)
5+
print square(3)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import io, sys, pytest, os, re, mock
2+
3+
@pytest.mark.it('The function square must exist')
4+
def test_for_functon_existence(capsys, app):
5+
assert callable(app.square)
6+
7+
@pytest.mark.it('The we tried 6 and it should return 36')
8+
def test_for_file_output(capsys, app):
9+
assert app.square(6) == 6*6
10+
11+
@pytest.mark.it('The we tried 47 and it should return 2209')
12+
def test_for_file_output(capsys, app):
13+
assert app.square(47) == 47*47
14+
15+
@pytest.mark.it("Use the ** operator")
16+
def test_operator():
17+
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
18+
with open(path, 'r') as content_file:
19+
content = content_file.read()
20+
regex = re.compile(r"\*\*")
21+
assert bool(regex.search(content)) == True
22+
23+
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def fact(x):
2+
if x == 0:
3+
return 1
4+
return x * fact(x - 1)
5+
6+
x=int(raw_input())
7+
print fact(x)
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
n=int(raw_input())
2+
d=dict()
3+
for i in range(1,n+1):
4+
d[i]=i*i
5+
6+
print d
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
values=raw_input()
2+
l=values.split(",")
3+
t=tuple(l)
4+
print l
5+
print t
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class InputOutString(object):
2+
def __init__(self):
3+
self.s = ""
4+
5+
def getString(self):
6+
self.s = raw_input()
7+
8+
def printString(self):
9+
print self.s.upper()
10+
11+
strObj = InputOutString()
12+
strObj.getString()
13+
strObj.printString()
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python
2+
import math
3+
c=50
4+
h=30
5+
value = []
6+
items=[x for x in raw_input().split(',')]
7+
for d in items:
8+
value.append(str(int(round(math.sqrt(2*c*float(d)/h)))))
9+
10+
print ','.join(value)
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
input_str = raw_input()
2+
dimensions=[int(x) for x in input_str.split(',')]
3+
rowNum=dimensions[0]
4+
colNum=dimensions[1]
5+
multilist = [[0 for col in range(colNum)] for row in range(rowNum)]
6+
7+
for row in range(rowNum):
8+
for col in range(colNum):
9+
multilist[row][col]= row*col
10+
11+
print multilist
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
items=[x for x in raw_input().split(',')]
2+
items.sort()
3+
print ','.join(items)
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
lines = []
2+
while True:
3+
s = raw_input()
4+
if s:
5+
lines.append(s.upper())
6+
else:
7+
break;
8+
9+
for sentence in lines:
10+
print sentence
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
s = raw_input()
2+
words = [word for word in s.split(" ")]
3+
print " ".join(sorted(list(set(words))))
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
value = []
2+
items=[x for x in raw_input().split(',')]
3+
for p in items:
4+
intp = int(p, 2)
5+
if not intp%5:
6+
value.append(p)
7+
8+
print ','.join(value)
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
values = []
2+
for i in range(1000, 3001):
3+
s = str(i)
4+
if (int(s[0])%2==0) and (int(s[1])%2==0) and (int(s[2])%2==0) and (int(s[3])%2==0):
5+
values.append(s)
6+
print ",".join(values)
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
s = raw_input()
2+
d={"DIGITS":0, "LETTERS":0}
3+
for c in s:
4+
if c.isdigit():
5+
d["DIGITS"]+=1
6+
elif c.isalpha():
7+
d["LETTERS"]+=1
8+
else:
9+
pass
10+
print "LETTERS", d["LETTERS"]
11+
print "DIGITS", d["DIGITS"]
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
s = raw_input()
2+
d={"UPPER CASE":0, "LOWER CASE":0}
3+
for c in s:
4+
if c.isupper():
5+
d["UPPER CASE"]+=1
6+
elif c.islower():
7+
d["LOWER CASE"]+=1
8+
else:
9+
pass
10+
print "UPPER CASE", d["UPPER CASE"]
11+
print "LOWER CASE", d["LOWER CASE"]
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
a = raw_input()
2+
n1 = int( "%s" % a )
3+
n2 = int( "%s%s" % (a,a) )
4+
n3 = int( "%s%s%s" % (a,a,a) )
5+
n4 = int( "%s%s%s%s" % (a,a,a,a) )
6+
print n1+n2+n3+n4
Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
values = raw_input()
2+
numbers = [x for x in values.split(",") if int(x)%2!=0]
3+
print ",".join(numbers)
Whitespace-only changes.

0 commit comments

Comments
 (0)