CSE Day 2 - Variables & While
CSE Day 2 - Variables & While
Wednesday, Sept. 25th
Wednesday, Sept. 25th
We can store a value (number, text, etc) in a container called a variable
These are just like variables in math class: x = 5 or message = "Hello"
We can then use and modify these variables to accomplish certain goals:
u.set_pixel(x_coord, y_coord, 200, 0, 0)
We also learned that we can use a variable to repeat code a certain number of times using the while loop.
Turn on a single line of white lights:
import unicornhathd as u
x = 0
while x < 16:
u.set_pixel(x, 0, 255, 255, 255)
x = x + 1
u.show()