In the previous lesson, you used lists to enable the Finch to record data about its environment. To store this data more permanently, you can write it to a file. For example, suppose the list tempValues stores a number of temperatures measured by the Finch. You can write those values to a file named “tempOutputFile.txt” using the code below. Notice that you need to convert each number to a string using the str() function before you can add it to the file.
Register to receive free access to all teacher materials.