logo

Crowdly

Browser

Додати до Chrome

25-In211-Pratique de la programmation en Python 1-

Шукаєте відповіді та рішення тестів для 25-In211-Pratique de la programmation en Python 1-? Перегляньте нашу велику колекцію перевірених відповідей для 25-In211-Pratique de la programmation en Python 1- в moodle.ipsa.fr.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

Переглянути це питання
Переглянути це питання

Qu'affiche le code python suivant?

def access(user):

    match user:

        case "admin" | "manager":

            return "Full access."

        case "Guest":

            return "Limited access."

        case _:

            return "No access."

print(access('User'))

print(access('manager'))

0%
0%
0%
0%
Переглянути це питання

Qu'affiche le code Python suivant ?

def ee(*ops, **kwargs):

strict = kwargs.get("strict", False)

results = []

for op in ops:

match op:

case ("add", x, y):

results.append(x + y)

case ("sub", x, y):

results.append(x - y)

case ("mul", x, y):

results.append(x * y)

case ("div", x, y):

try:

results.append(x / y)

except ZeroDivisionError:

if strict:

raise ZeroDivisionError

results.append(None)

case _:

pass

return results

print(ee(("add", 2, 3), ("mul", 3, 4)),

ee(("div", 1, 0), ("div", 4, 2)),

ee(("noop",), ("sub", 5, 2), ("div", 10, 5)))

0%
0%
0%
0%
0%
Переглянути це питання

Qu'affiche le code Python suivant ?

def cc(*cmds):

stack = []

outputs = []

for c in cmds:

match c:

case ("push", x):

stack.append(x)

case ("pop",):

if stack:

outputs.append(stack.pop())

case ("sum",):

if len(stack) >= 2:

a = stack.pop()

b = stack.pop()

stack.append(a + b)

case _:

pass

return outputs

print(cc(("push", 1), ("pop",), ("pop",)),

cc(("push", 1), ("push", -1), ("sum",), ("pop",)),

cc(("pop",),))

0%
0%
0%
100%
0%
Переглянути це питання

Le constructeur d'une classe correspond à : 

0%
0%
0%
100%
Переглянути це питання

Analysez le code suivant et identifiez le(s) problème(s) potentiel(s) :

import json

file = open("data.json", "r")

data =

json.load(file)

print(data["key"])

print(f"Clé

introuvable : {e}")

print("Fichier non trouvé")

file.close()

0%
0%
0%
0%
Переглянути це питання

Quelle affichage produit le code python suivant?

D = {'pomme': 3, 'orange': 6, 'tomate': 2}

try:

   x = D['banane']

   print(x)

except TypeError:

   print("Error1")

except KeyError:

   print("Error2")
0%
33%
67%
0%
Переглянути це питання

Qu'affiche le code python suivant?

def http_response(status):

   match status:

       case 200 | 201:

           return "Success"

       case 500 | 502 | 503:

           return "Server Error"

       case _:

           return "Unknown Status"

print(http_response(500)) 

print(http_response(202)) 

0%
0%
0%
100%
Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.ipsa.fr?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome