Skip to main content

Subtraction

src/subtraction.py
from nada_dsl import *

def nada_main():
party_alice = Party(name="Alice")
party_bob = Party(name="Bob")
party_charlie = Party(name="Charlie")
num_1 = SecretInteger(Input(name="num_1", party=party_alice))
num_2 = SecretInteger(Input(name="num_2", party=party_bob))
difference = num_1 - num_2
return [Output(difference, "difference", party_charlie)]

Run and test the subtraction program

1. Open "Nada by Example"

Open in Gitpod

2. Run the program with inputs from the test file

nada run subtraction_test

3. Test the program with inputs from the test file against the expected_outputs from the test file

nada test subtraction_test
Feedback