First time programing

Would like to get into programing.
Was thinking Python.
Where to start.
Where to get programs (Windows 10) do have one PC with Linux if need be.
Can this been done using online information only, our would getting books be helpful.
Would have to do this in the beginning for free, and if I get the hang of it, would be willing to spend the money on getting better.
The way I learn things the best is understanding the structure, how thinks work, then get into programing little thinks. If there was a way, or book that would break down a program and tell you why this is done this way. Ex this is a bit of code and this is why it is used.

I know nothing about programing would like to learn something.

1 Like

The basic concepts of programming are pretty easy. Syntax is likely going to be the trickiest part to get down at first.

Basic programming is as follows.

Variables can store values. For example,

x = 5
or
name = "cotton"

The left hand side of the “=” is the variable name. The right side of the “=” is some value. Furthermore, the value on the right is a “type” of data. For example, “cotton” is a string datatype.

Other datatypes include: Dictionary (aka Associative Array/Map), Array, String, Integer, etc.

Another basic concept are “control flow constructs” that direct the flow of the program. One of these are “if” statements.

For example,

if ( name == "cotton" ) 
   doSomething ...
else
  doSomethingElse ...

One of the datatypes is an array. Below is an example of an array of strings:

arrayX=[“cat”,“dog”,“soccer”,“linux”]

We can print values from our array like this (in pseudo code):

print arrayX[0]

That would print “cat”

print arrayX[1]

That would print “dog”

The only tricky part of arrays are that, typically, they are “zero indexed” meaing the first index, or value, is “0” and not “1”.

This brings me to my final point, which is looping. It’s a control flow construct. You can use a “for” loop to iterate over an array to do something to each index(value).

For example in python-like pseudo code and using the array from above:

for thing in arrayX:
print thing

That would print:
“cat”
“dog”
“soccer”
“linux”

To summarize - the basics of concepts of programming might be awkward at first, but once you learn them them - typically, the apply all programming languages. The names might be different, ie one language may call something a hashmap, and another might call it a dictionary, but they are the same thing.

Therefore, take some time to get familiar with variables, datatypes, conditional statments (if statements), and loops. Once you have that down you’ll be in really good shape.

Good luck!

cotton

3 Likes

Thanks for the info.
Where would I start with Python.
Things like compilers
and either web sites for books.

The best way to learn is to start coding.

You should use the documentation for the language you are using and familiarize with that. If you are able to use the documentation properly you will learn a lot faster.

I would find some simple tutorials to start with so you can get started with the different programming concepts and so on. Make sure to learn what they are and how they work. Whenever there is something in the code you are curious about, or don’t fully understand, look it up online or in the documentation.

I have not worked with python myself, but look here for some info on getting started. Pretty sure someone more familiar with python will come along here soon and drop some more info for you.

Online docs for python:
https://docs.python.org/3/

2 Likes

There are a lot of books out there on programming, one I would recommend that I used myself back when I went to university is “Introduction to computing systems - from bits & gates to C & beyond” by Yale N. Patt and Sanjay J. Patel.

The book covers the basics of how computer works, from bits and through the different abstraction layers such as machine code and all the way to programming in C. It does not directly teach python, but the book is a great resource to learn the basics of programming in general, and beyond if you are also interested in the basic functioning of computers.

Link to an amazon page of the book:

1 Like

Go here: https://repl.it/languages/python3

Set variable x to “programming is fun”

Now print x.

Once your done with that create a dictionary called fact. Make index 0 = “programming” index 1 = “is” index 2 = “fun”

Print fact[2].

Finally, write a for loop to iterate over the entire array and print each value.

That’s a good lesson. If you have trouble or questions, post here, I’ll reply. Keep in mind everything above is googleable, but I’m happy to help.

Good luck!

cotton

1 Like

You can copy and paste the following block into that online python interpreter and hit “run” to see what happens. The comments hopefully help explain what’s going on.

#CODE - create an array of strings
#In English - set arraySentence equal to the array of strings which follows

arraySentence = ["check","out","how","easy", "programming", "really", "is."]

#CODE - print each index of arraySentence
#In English - for each index (word) in the array arraySentece print the index (word)
#In this case "word" can be whatever you want just make sure you use the same name in the print statement

for word in arraySentence:
    print(word)

#Creating blank lines in the console to make it easier to read
#Ignore for now
print("\n \n")

#The following is called string concatination.
#We are going to build a string by adding each index from our array above to the end of a string variable.
#CODE - Set variable sentence to an empty string

sentence = ""

print("Printing content of variable sentence before concatenation")
print(sentence)
print("The above line is blank because we set sentence to an empty string - so nothing is printed \n")

#Concatenate sentence by adding a "space" + the word to the end of the blank string from above
for word in arraySentence:
    sentence += " "+word

print("After concatenating string ")
print(sentence)
2 Likes

“The hard way” programming guides are pretty good from memory.

1 Like