Skip to content

Commit

Permalink
Added Solution to Task 4 and Task 5 (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitmisraw authored and mubaris committed Jan 17, 2018
1 parent cb4b230 commit 3c3edd5
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
Binary file added Solutions/arpitmisraw/Task4/wave.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions Solutions/arpitmisraw/Task4/wave.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import matplotlib.pyplot as plot
import numpy as np



x = np.arange(0, 10, 0.001)
y = 2 * np.sin(np.pi *x /4)

plot.title('Sine Wave')
plot.xlabel('x')
plot.ylabel('y')

plot.plot(x, y)
plot.savefig('wave')
plot.show()
26 changes: 26 additions & 0 deletions Solutions/arpitmisraw/Task5/threading.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import threading

def factorial(n):
i = 1
ans = 1
while(i <= n):
ans *= i
i += 1
print("Factorial of", n, "is", ans)


def square(n):
print("Square of", n, "is", n**2)


n = int(input())
t1 = threading.Thread(target=factorial, args=(n,))
t2 = threading.Thread(target=square, args=(n,))
t1.start()
t2.start()
t1.join()
t2.join()




0 comments on commit 3c3edd5

Please sign in to comment.