Tasks solved
This commit is contained in:
parent
bcb001350a
commit
4481e139c5
6
intro/Task102.py
Normal file
6
intro/Task102.py
Normal file
@ -0,0 +1,6 @@
|
||||
def add_three_numbers(x, y, z):
|
||||
return x + y + z
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(add_three_numbers(2,5,7))
|
||||
print(add_three_numbers(-3,-1,2))
|
5
intro/Task103.py
Normal file
5
intro/Task103.py
Normal file
@ -0,0 +1,5 @@
|
||||
def probabilty(x):
|
||||
if x >= 0 and x<=1:
|
||||
return x
|
||||
else:
|
||||
return 0
|
5
intro/Task104.py
Normal file
5
intro/Task104.py
Normal file
@ -0,0 +1,5 @@
|
||||
def farenheit(x):
|
||||
if x< -273.15:
|
||||
return -459.67
|
||||
else:
|
||||
return(x * 9/5) + 32
|
8
intro/Task105.py
Normal file
8
intro/Task105.py
Normal file
@ -0,0 +1,8 @@
|
||||
def is_almost_prime(x, limit):
|
||||
if x <0:
|
||||
return False
|
||||
else:
|
||||
for y in range(2, limit+1):
|
||||
if(x % y == 0):
|
||||
return False
|
||||
reutrn True
|
5
intro/Task106.py
Normal file
5
intro/Task106.py
Normal file
@ -0,0 +1,5 @@
|
||||
def penultimate(list, otherwise):
|
||||
if len(list) < 2:
|
||||
return otherwise
|
||||
else:
|
||||
return list[-2]
|
Loading…
Reference in New Issue
Block a user