Starting today, I'm gonna finally learn Python...
A fun little test program that you can make is a Fibonacci sequence generator (it's a sequence of numbers starting from zero where the next number in the sequence is the sum of the previous two. In mathematics, this sequence can be used to create an infinite, perfect spiral.) To make it, you can use only 4 lines of code, although it's a little easier to read if you use 6 lines instead. Here's the code: (You should know that in Python, #'s are used for adding comments to code, but here I put my comments in a separate section below to make it less cluttered.) 1. a, b = 0, 1 2. while True: 3. print(a) 4. a, b = b, a+b 1. # This sets the variables "a" and "b" equal to 0 and 1 respectively. If you used two separate lines to write this, it would look like: 1. a = 0 2. b = 1 2. # This is a while loop. It says that while a certain condition is met, to continue doing whatever code is encased in the loop. In this case, the condition is True, so the loop will just repeat infinitely. If you wanted the program to end after, say 5 seconds, you could instead type: while a < 99999..., Note: basic math is extremely easy for computers, so you're likely going to have to add a bunch more 9's to keep the program running for more than half a second. 3. # This is pretty obvious, it just prints out the current value of the variable "a". 4. # This is the most complicated line, and the one that does most of the work. It's a condensed form of writing out: 1. a = b 2. b = a + b Which means: After the initial value of "a" is printed out, the value of "a" is reassigned to become whatever "b" is. After this, the value of "b" is reassigned to become the value of "a" + "b". Then after that, those last two lines will loop until you close the program. In the end, it should look like this: https://files.catbox.moe/ugt4ec.mov Edit: Wow, the old, broken digibutter video player is trying to embed the video lol.
reply to TheEvilShadoo
Hmm, looks cool, done some Fibonacci before, I'll try it out later. Thanks
reply to GamerKid
You are going to enjoy it's simplicity and ease of accessories may I suggest getting geany organelles and pyautogui for some cool stuff..though later of course...