1
0
forked from tdwojak/Python2017
This commit is contained in:
s45167 2018-01-26 15:12:25 +01:00
parent 5a2a035e5c
commit bfc444b701
3 changed files with 44 additions and 0 deletions

20
labs03/z1.py Normal file
View 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
View 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
View 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()