forked from tdwojak/Python2017
done
This commit is contained in:
parent
5a2a035e5c
commit
bfc444b701
20
labs03/z1.py
Normal file
20
labs03/z1.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
def f(typ):
|
||||||
|
return id(typ)
|
||||||
|
|
||||||
|
def tests():
|
||||||
|
lista=[1,2,3]
|
||||||
|
napis='1234'
|
||||||
|
float=1.42
|
||||||
|
id_table_back = [f(lista),f(napis),f(float)]
|
||||||
|
typ = ['lista','napis','liczba zmiennoprzecinkowa']
|
||||||
|
lista.append(5)
|
||||||
|
napis='1234'+'5'
|
||||||
|
float*=2
|
||||||
|
id_table_now = [f(lista), f(napis), f(float)]
|
||||||
|
|
||||||
|
for i in range(len(id_table_back)):
|
||||||
|
if id_table_back[i]==id_table_now[i]:
|
||||||
|
print(typ[i],'jest mutable')
|
||||||
|
else:
|
||||||
|
print(typ[i],'jest immutable')
|
||||||
|
tests()
|
12
labs03/z2.py
Normal file
12
labs03/z2.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
def Fibo(n):
|
||||||
|
for i in range(n):
|
||||||
|
if n==0:
|
||||||
|
return 1
|
||||||
|
elif n==1:
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
a=Fibo(n-1)
|
||||||
|
a+=Fibo(n-1)
|
||||||
|
return a
|
||||||
|
|
||||||
|
print(Fibo(4))
|
12
labs03/z3.py
Normal file
12
labs03/z3.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import requests
|
||||||
|
import json
|
||||||
|
|
||||||
|
def script():
|
||||||
|
page='https://api.fixer.io/latest'
|
||||||
|
r=requests.get(page)
|
||||||
|
r.status_code
|
||||||
|
r.encoding
|
||||||
|
r.text
|
||||||
|
data_json=r.json()
|
||||||
|
print(data_json['rates'],data_json['rates'].values())
|
||||||
|
script()
|
Loading…
Reference in New Issue
Block a user