Message after April 8 Class:
There will be no class in room 504 on Wednesday, April 15. The next class will be on Wednesday, April 22.
I may try to arrange an online meeting during the scheduled class time. If possible, please plan to be at your home computer at 4 PM (or so ) on Wednesday, April 15. If we meet we will be using Google Hangout. You will need a Google account for that. Setting up a Google account on line takes only a few minutes.
I have posted examples of the programs we were coding in class on April 8 ( printing a list, finding the largest number in a list, sorting a list). There are several versions of each program in the examples. You can copy these programs, paste them into a program window in IDLE and run them. You could also right-click them and download them if you prefer.
The "Sort List - advanced example" program introduces some new Python functions. I think you could learn some useful things by comparing that program to the "Sort List example"
The example programs shown when you click the "Program Examples" link include all the Python coding covered in class so far, and will include all the 6 topics listed below. I encourage you to study them, and to copy and run them. They also cover some new things, like the difference between numeric variables and string variables. These would be good to learn on your own. We will eventually go over them during a class.
There are two more things that I consider especially important for you to lean in Python. These are items 5 and 6 in the list below. Once you have those, you will know enough to write most programs that deal with text and numbers. There are a lot of additional things to learn that are very useful in writing Python programs and we will cover some of them. Most of them provide much better (less time to write code, easier to work with, programs that run faster ) ways of doing things you could do with the six things listed below if you had the patience and time :
1] variables : strings and numbers - my_num_var = 22 my_str_var = "Whatever you like!" list_index = list_index + 1
2] lists : my_num_list = [ 18, 85, 22, 18] my_str_list = ["one", "two", "house", "several words in one string"]
my_mixed_list = [1,"Charley", "Brown", 2, "Lucy", "Von Pelt" ]
3] while loops : loops in general, there are other kinds of loops
counter = 0
while(counter < 10)::
print("counter is now = : ", counter)
counter = counter + 1
4] conditional statements:
var_a = 25
if (var_a > 25):
print("var_a is greater than 25")
else:
print("var_a is less than or equal to 25")
5] user input : How to allow the person running the program to type in data (strings or numbers) that will be used by the program.
We have not covered this yet, but there is an example program in the "Program Examples"
6] File input and output : How to have the program read data from a saved file, how to have the program create a file, and how to have the program write data into a file.
We will go over this soon. There will be an example in the examples list soon.
I think of the above 6 things as the fundamental concepts of programming. My goal is to have you work with them enough that they seem obvious and simple to you. My experience has been that students who have never done any programming do not find these obvious or simple at the very beginning. I see this kind of learning, at the start, as a significant "paradigm shift", and these are always a challenge. The next most important thing (almost item # 7) is how to define a function so that a program can use a piece of a program over and over without having to repeat all the statements needed each time. I will post an example of that also. It's one of the easiest things to learn and use.