Explained

A code guide…

”’Welcome to my guide of python 3”’
Ignore all the “”’s and #s” it’s something to do with code that I’m NOT going to teach you

”’if statements”’
myvariable = 1
if myvariable == (1):
print (“myvariable = 1″)

”’ what this code means”’
”’If the variable “myvariable~” is the same as “1” then print “myvariable = 1″”’

”’inputs”’
input(“What’s your name?”)
”’what this code means”’
”’ask the user “What’s your name?” then do nothing”’
name = input(“What’s your name?”)
print (f”{name}”) #see more about formatted writing on lines 22 – 26
”’what this code means”’
”’ask the user “What’s your name?” then set the variable “name” to their answer. Then print “name””’

”’formatted writing”’
myvariable_ = (“hello!”)
print (f”{myvariable_}”)
”’what this code means”’
”’set the variable “myvariable_” to “hello!” then print the variable “myvariable_””’

”’while loops”’
from time import sleep # (This is an import, more on these on lines 36)                                                      while True:
print (“hello!”)
sleep(0.1)”’
”’what this code does”’
”’while true (I don’t know what it means by true) print “hello!” then wait 0.1 seconds before running again. Continue forever.”’

”’imports”’
”’for an example please see line 29”’
”’what this line of code does”’
”’import from the pack “time”, “sleep”. sleep is not possible without imports like a lot of other things”’
”’if you have already imported the pack/part of pack then you don’t need to again”’
”’If you wan’t to import a whole pack just do “import <pack name>”

”’for loops”’
from time import sleep
for i in range(5):
print(f”this code has been repeated {i+1} times”) #see “formatted writing on lines 22-26
sleep(0.1)
”’what this code does”’
”’from the pack “time”, import “sleep”. change variable “i” (this can be any variable, but this is most commonly used in this
instance) by one every time 1 loop finishes. In 1 loop print “this code has been repeated i+1 (the variable i, add 1) times”
wait 0.1 seconds then repeat unless the loop has repeated 5 times already”’