Ver a proveniência

First Part of assignment made

master
Marcel Haazen há 4 anos
ascendente
cometimento
097a4bb1d5
Assinados por: nekocentral <marcel@haazen.xyz> ID da chave GPG: C912C3DFE2C4FB9D
2 ficheiros alterados com 32 adições e 4 eliminações
  1. +17
    -4
      practicum_1_getallen_student.py
  2. +15
    -0
      test.py

+ 17
- 4
practicum_1_getallen_student.py Ver ficheiro

@ -24,18 +24,23 @@ Let op! Je mag voor deze opdracht geen extra modules importeren met 'import'.
def floor(real):
""" Retourneert het grootste gehele getal (int), dat kleiner dan of gelijk is aan real (float). """
k">return
n">num = real//1
return num
def ceil(real):
""" Retourneert het kleinste gehele getal (int), groter dan of gelijk aan real (float). """
return
num = -(-real//1)
return num
def div(n):
""" Retourneert een (natuurlijk) gesorteerde verzameling (list) van delers van n (int).
Het getal a N is een deler van n N, als er een b N is, zodat a × b = n. """
divisors = []
for i in range(1, int(n / 2) + 1):
if n % i == 0:
divisors.append(i)
divisors.append(n)
return sorted(divisors)
@ -43,7 +48,15 @@ def is_prime(n):
""" Return True als n (int) een priemgetal is, anders False.
Je kunt gebruik maken van de functie 'div(n)' om te bepalen of n een priem is.
Optioneel: bedenk een efficiënter alternatief. """
return
if n <= 1:
return False
for x in range(2, n):
# if number is divisble by x, return False
if not n % x:
return False
return True
def primefactors(n):

+ 15
- 0
test.py Ver ficheiro

@ -0,0 +1,15 @@
from huawei_lte_api.Client import Client
from huawei_lte_api.AuthorizedConnection import AuthorizedConnection
from huawei_lte_api.Connection import Connection
# connection = Connection('http://192.168.8.1/') For limited access, I have valid credentials no need for limited access
# connection = AuthorizedConnection('http://admin:MY_SUPER_TRUPER_PASSWORD@192.168.8.1/', login_on_demand=True) # If you wish to login on demand (when call requires authorization), pass login_on_demand=True
connection = AuthorizedConnection('http://admin:127Fiets!@192.168.8.1/')
client = Client(connection) # This just simplifies access to separate API groups, you can use device = Device(connection) if you want
print(client.device.signal()) # Can be accessed without authorization
print(client.device.information()) # Needs valid authorization, will throw exception if invalid credentials are passed in URL
# For more API calls just look on code in the huawei_lte_api/api folder, there is no separate DOC yet

Carregando…
Cancelar
Guardar