You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LessonScreen(8, "Else and elif statements", self.else_elif),
53
+
LessonScreen(9, "\"WHAT THE HECK IS A METHOD!?!?!?\" (your comments)", self.methods),
54
+
LessonScreen(10, "A function. Ok? I will tell you what a function is.", self.functions)
55
+
]
40
56
super(Screens, self).__init__(master)
41
57
self.master=master
42
58
self.master.title("LearnPythonWithPython")
43
59
self.pack(fill=BOTH, expand=1)
44
-
self.u1= [
45
-
Screen(1, "Setting up the IDE", self.idle),
46
-
Screen(2, "Basic syntax", self.syn),
47
-
Screen(3, "Variables", self.var),
48
-
Screen(4, "Data types", self.data_types),
49
-
Screen(5, "Hello, world!", self.hello_world),
50
-
Screen(6, "Input", self.inp),
51
-
Screen(7, "If statements", self.if_statement),
52
-
Screen(8, "Else and elif statements", self.else_elif),
53
-
Screen(9, "\"WHAT THE HECK IS A METHOD!?!?!?\" (your comments)", self.methods)
54
-
]
55
60
56
61
defs_init(self, unitNum):
57
-
self.new(home=True)
62
+
print("s_init")
63
+
self.new(0)
58
64
s="self.unit_"+str(unitNum)+"()"
59
65
exec(s)
60
66
self.master.geometry(self.homeBounds)
61
67
62
68
defunit_1(self):
63
-
foriinrange(len(self.screens)):
69
+
print("u1")
70
+
foriinrange(len(self.u1)):
64
71
s=self.u1[i]
65
-
self.cenBtn(s.showAs, lambda: self.goTo(s.func))
66
-
67
-
defgoTo(self, func):
68
-
self.master.geometry(screenBounds)
69
-
func()
72
+
self.cenBtn(s.showAs, s.func)
70
73
71
74
defidle(self):
72
-
self.new_lesson(1)
75
+
self.new_lesson(1, 1)
73
76
self.multiLbl("Hello, and welcome to LearnPythonWithPython. Today we will be learning about how to set up the IDE called IDLE but ... come to think about it, you are viewing this application so you probably already have IDLE installed. See you later.")
74
77
75
78
defsyn(self):
76
-
self.new_lesson(2)
79
+
self.new_lesson(1, 2)
77
80
self.multiLbl("Congratulations! You've completed lesson 1. This is lesson 2. To see the basic syntax, look at the source code for this application.")
78
81
79
82
defvar(self):
80
-
self.new_lesson(3)
83
+
self.new_lesson(1, 3)
81
84
self.multiLbl("Just like literally every single coding language in the world (except for maybe like BASIC and Assembly) and for sure every C based coding language (hint hint: Python is a C-based language), there are variables. There are many different types of variables in Python. Some examples are booleans (coming from Boolean algebra), lambdas (from lambda calculus) and numbers (from litterally every single form of math). Unlike 6th grade math, 7th grade math, 8th grade math, 9th grade math (Algebra I), 10th grade math (Geometry), 11th grade math (Algebra II), 12th grade math(Trigonometry?), college math(Calculus, Linear algebra, etc, etc, etc, and etc.), and some high school and college science(physics), variables in coding can have names longer than 1 letter with subscript. The only downside is that it takes up memory, and it takes up soooo mmuch storage. Like entire bytes. Soooooooo much!!!")
82
85
83
86
defdata_types(self):
84
-
self.new_lesson(4)
87
+
self.new_lesson(1, 4)
85
88
self.multiLbl("As I said last lesson, variables can be mmmmmmaaaaaannnnnnyyyyyy different types of things. A variable can be an str which is an str-ing of text surrounded by quotes (e.g. \"Hello, world!\"), an int which is an int-eger (e.g. 42), a float which is a float-ing point number (e.g. 3.14159265358979323846264338327950288419716939937510), a boolean which is a boolean value (which is either True or False. I think it's False. Wait nevermind it's true.), an array which stores an array of values surrounded in brackets where all the values are seperated by ,s (e.g. [\"Why?\", \"Are we stronger than the elements?\", \"What's yellow and dangerous?\", \"What do you get when you multiply six by seven?\", \"How many Vogons does it take to change a lightbulb?\", \"How many roads must a man walk down?\", 42, True, [\"Waaaait... an array inside an array?\", \"that's cray-cray\"], \"Is the array done yet?\", False,...] you get the idea.), a dictionary which is basically a dictionary for variables (e.g. ages = {\"Bob\": 100, \"Me\": 11}) and sooooo on and soooo forth")
86
89
87
90
defhello_world(self):
88
-
self.new_lesson(5)
91
+
self.new_lesson(1, 5)
89
92
self.multiLbl("Hello world programs are usually the first to be learned because they are so simple, but why do they make them so simple? Those programs could be made harder and more fun by just a little bit. First things first, you need to know what a hello world program looks like, so look in the console. Go on. I'm not going anywhere. You want to be able to do that? Well, that sucks for you. This lesson is not about hello world. It's about the base methods in Python. \"What's a method?\" I hear you typing in the comments. Well, I'm not telling you. And also I don't read the comments. So sucks for you.\nSo any ways, there are many base methods >:(don't even try asking):< such as print and input. Print prints text to the console. Input asks the user for input. That simple. Well not really. In print you have to put () after it because it's a *method* and inside those parentheses put what you want to say (HAS TO BE AN STR (can be a variable)), for example print(\"LearnPythonWithPython\") will print LearnPythonWithPython. Seriously. Try it. PRESS LE BUTTON!!!")
90
-
code="""
91
-
print("LearnPythonWithPython")
92
-
"""
93
+
code="""print("LearnPythonWithPython")"""
93
94
self.cenBtn(code, lambda: exec(code))
94
95
self.cenLbl("It's time for CHALLENGE TIME: Try to make a hello world program by declaring a variable called string and print()ing it")
95
96
96
97
definp(self):
97
-
self.new_lesson(6)
98
+
self.new_lesson(1, 6)
98
99
self.multiLbl("Hello, world! That last (mini) project was fun...ish. We want to make programs with UI! We want user input() ... i mean interface lol lmao rofl lellellellellelelelelelllelleleellelelelellelelel. so user \"interface\" as they call it is an interface where users interact. Hey! There's another possible name! User Interaction stuf! well anyways, let's get to the point. The input() method is a good starting point for UI. It allows the user to enter ... wait for it ... input()! Inside the parentheses thingies, you have to type in what ever you want the computer to ask you. For instance, press the button that has a line of code on it.")
99
-
code="""
100
-
inp = input("Enter your input here: ")
101
-
print(inp)
102
-
"""
100
+
code="""inp = input("Enter your input here: ")
101
+
print(inp)\t\t\t\t"""
103
102
self.cenBtn(code, lambda: exec(code))
104
103
self.cenLbl("Now you try to figure out a practical purpose for the input() method. Enter it in the comments (that I tooooootally read)")
105
104
106
105
defif_statement(self):
107
-
self.new_lesson(7)
106
+
self.new_lesson(1, 7)
108
107
self.multiLbl("If statements determine *if* a condition (e.g. 1>2 is False and \"hello\" == \"hello\" is True) is True, then it does the stuff indented after the colon(:). One example is")
109
-
code="""
110
-
if True:
111
-
\tprint("if True: \n\t\"is always evaluated\"")
112
-
if False:
113
-
\tprint("if False: \n\t\"is never evaluated\"")
114
-
"""
115
-
self.cenBtn(btnText, lambda: exec(code))
108
+
code="""if True:\t\t\t\t\t
109
+
\tprint("if True: is always evaluated")
110
+
if False:\t\t\t\t\t
111
+
\tprint("if False: is always evaluated")"""
112
+
self.cenBtn(code, lambda: exec(code))
116
113
117
114
defelse_elif(self):
118
-
self.new_lesson(8)
115
+
self.new_lesson(1, 8)
119
116
self.multiLbl("\"But ... what if you want to test if something you just tested is not True? Do you need another if statement with (whatever condition) == False?\" I hear you commenting in the comment section. Well, the answer is NO STUPID!!! THIS IS PROGRAMMING!!! AND THIS LESSON EXISTS!!! LOOK AT THE TITLE!!! WHAT DID YOU THINK IT WOULD BE ABOUT??? The solution lies in else statements, which literally translate to ... you guessed it — else. You just type else: and then whatever the print(\"****\") you want if the condition you tested is false. \"But what if you want to have an if and else statement *inside* an else statement?\" The answer is THIS IS CODING YOU NOT SMART PERSON. And plus, it says it in the title. elif is short for else if which is short for else-erwise if this is true.")
120
117
121
118
defmethods(self):
122
-
self.new_lesson(9)
119
+
self.new_lesson(1, 9)
123
120
self.multiLbl("Now, we're finally going to answer that question: \"WHAT THE HECK IS A METHOD?!?!?!?!?!?!?!?!?!\" Geez. Stop commenting. ITS BAD 4 UR PUNCSHOOASHUN CUPZ LOC KEE AN SPELEENG. IT WILL TURN THE SQL DATABASE THAT I DON'T READ INTO A YOUTUBE COMMENTS! I LITTERALLY MAKE THE WORDS UR COMMENT HAS BEEN RECIEVED APPEAR EVEN IF I NEVER READ IT!!! SHOOT MY CUZ LUC KEE IZ BROCEN I M USING A MAC ALL MY TEXT IS NOW AND FOREVER CAPITALIZED :(:(:(:(:(:(:(")
124
121
self.multiLbl("SO, ANYWAYS, A METHOD IS A FUNCTION INSIDE OF A CLASS. \"WHAT ARE FUNCTIONS AND CLASSES?\" YOU WILL FIND OUT NEXT LESSON.")
125
122
126
123
deffunctions(self):
127
-
self.new_lesson(10)
128
-
self.multiLbl("A function. Use def function_name:\n\t#insert_code_here to create a function and function_name() to call it.")
124
+
self.new_lesson(1, 10)
125
+
self.multiLbl("A function. Use:\n def function_name(args):\n\t#insert_code_here\n to create a function and function_name(args) to call it. You can have as many args as you want and they can be whatever you want. Be warned. Functions are eeeeevvvvveeeeerrrrryyyyywwwwwhhhhheeeeerrrrreeeee. Print is a function. Input is a function. If you look at the source code, you might see functions such as eval and exec. There are many other functions just 2 name a few.")
0 commit comments