microbit = codesters.Microbit()
microbit.show_string("hello")
data = microbit.get_temp()
microbit.show_number(data)
data_list = []
time_list = []
t = codesters.Teacher()
scatter_plots = t.get_parameters_for_function("ScatterPlot")
try:
tval1 = scatter_plots[0][0]
tval2 = scatter_plots[0][1]
except:
tval1 = "DNE"
tval2 = "DNE"
tval3 = "DNE"
t1 = TestObjective()
t1.add_success(tval1 == "time_list", "Great job!")
t1.add_failure(tval1 == "x_data", "Did you change the first parameter to time_list?")
t1.add_failure(tval1 == "data_list", "Oops! Did you mix up the first and second parameter?")
t1.add_failure(tval1 == "DNE", "Did you drag in Scatter Plot?")
t2 = TestObjective()
t2.add_success(tval2 == "data_list", "Great job!")
t2.add_failure(tval2 == "y_data", "Did you change the second parameter to data_list?")
t2.add_failure(tval2 == "time_list", "Oops! Did you mix up the first and second parameter?")
t2.add_failure(tval2 == "DNE", "Did you drag in Scatter Plot?")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)