Compare commits
No commits in common. "967bb947a450d53ce9409b51ca6467409433d0c0" and "65c850800cc34948366f5bd79130f4e4309a12e2" have entirely different histories.
967bb947a4
...
65c850800c
@ -187,33 +187,6 @@ def mirror(n: int) -> int;
|
||||
return res
|
||||
```
|
||||
|
||||
## Exercise 2.3
|
||||
```python
|
||||
def factorial(limit: n) -> int:
|
||||
n = 0
|
||||
if limit <= n:
|
||||
return n
|
||||
else:
|
||||
f = 1
|
||||
while f < limit:
|
||||
n += 1
|
||||
f *= n
|
||||
if n % 2 == 0:
|
||||
return (n-2)
|
||||
else:
|
||||
return (n-1)
|
||||
```
|
||||
|
||||
## Exercise 2.4
|
||||
```python
|
||||
def prime(n: int) -> int:
|
||||
"""
|
||||
Check if n(int) is prime if n > 1, error otherwise
|
||||
"""
|
||||
if n <= 1:
|
||||
raise Exception("prime: n<= 1")
|
||||
elif n % 2 == 0:
|
||||
return n == 2
|
||||
## Exercise 3.3
|
||||
```python
|
||||
def quotient(a: int, b: int) -> int:
|
||||
|
Loading…
x
Reference in New Issue
Block a user