**Intro**

Computer Science is not the study of computers nor is it only about programming. Sometimes, when people hear about Computer Science, they think oh, computers and programming!

In reality, computers are just a tool in computer science, and programming simply executes a sequence of instructions that we create.

Computer Science is all about computation, asking the question: “What exactly can be computed, how can we compute it, and how fast we can compute it?”

Computation is a fancy way of saying any type of calculation that follows rules or list of steps.

Multiplying numbers like 1 times 2 is a computation. There are rules and steps to multiplying two numbers. Likewise, adding 15 + 5 is a computation.

Computer scientists often toss the word algorithms, and that sounds fancy, but algorithms are simply the way that we solve problems.

Algorithms are just the list of steps that we use to solve any type of problem.

The rules and list of steps that apply to addition like remember to carry your 1s to the next column if the current column adds to 10 or above is an algorithm.

When you hear computations, computations are calculations that follow algorithms.

Because Computer Science dives into computations, we also think of problem solving.

“Can we solve this problem? How hard is this problem? How fast can we make the solution?”

Problem solving use computations!

The most important skill of computer science is problem solving.

Learning a programming language like Python is an excellent way to help you practice solving problems because programs are step-by-step instructions that you create in essence to solve your problems!

If algorithms are the ways or the list of steps that we use to solve problems, programming is about taking our algorithms that we have thought and planned and writing them into programming languages like Python.

The reason that we learn programming while learning Computer Science is because programming languages are languages that express computations and also solve problems for you.

Although we’ll be using Python as our language of choice in these lectures, the language is not important.

Understanding the fundamentals of programming and practicing problem solving in your own personal objectives and context is far more important.

Practice makes perfect.

**Values, expressions, and statements**

Assuming that you have Python already installed on your computer, you can save an empty file as a Python file by making sure that it has a .py extension.

Python has an IDE, integrated development environment, which serves as a program that can run a Python program. I’m using Python 3.6 in this book.

The first thing about Python that we’ll talk about are values. Values are letters or numbers that can be used in the language.

Every value has a type. Numbers like 1 and 2 have the type called: integers.

Words or sentences like “Hello world!” have the type called: strings.

Strings are enclosed in quotation marks.

The next thing that we’ll talk about are functions. Functions are fancy terms defining commands that do something in Python.

The most used function in Python is the: print function. The print function displays values on the screen.

To use print, you write, print and enclose a value inside a pair of parentheses.

1 2 |
print(4) print("Hello world!") |

You can run the program. What’s displayed is 4 and Hello world!:

1 2 |
4 "Hello world!" |

You can also check the type of your value with the type function. Python has a bunch of these preconfigured functions like print() and type().

type(value) gives us the type of the value enclosed in the parentheses.

You can put functions within functions. We’ll put the type function inside the print function, so we can tell what type the 4 and “Hello world!” are.

1 2 |
print(type(4)) print(type("Hello world!")) |

What’s displayed is int, which is short for integer, and str, which is short for string because 4 is of type, integer, and “Hello world” is of type, string.

**Variables**

Now, let’s talk about variables. Variables give a name to our values. We can assign new variables with values. The variable name must be on the left side, and the values must be on the right side.

For example,

1 2 3 |
question = "How are you today?" x = 5 y = 2.5 |

question is now the equivalent to the string, “How are you today?” because of our assignment. Likewise, x is the equivalent to 5.

The print and type functions work with variables, so we can use print and type on these variables.

1 2 3 |
print(type(question)) print(type(x)) print(type(y)) |

What’s displayed is:

1 2 3 |
str int float |

float is the type given when there is a decimal point dividing the integer and fractional part. 2 and a half has a decimal, so it’s a float type.

Variable names can use a combination of letters and numbers, and variable names are case sensitive.

When you use multiple word variable names, typically, you leave an underscore between each word like:

1 |
python_tutorial_question = "What can be computed?" |

There are illegal characters that you cannot use in variable names like the $ symbol.

1 |
cs101$ = "Computer Science 101" |

There are keywords in Python. You cannot give a variable the same name as a keyword.

For example,

1 |
class = "Computer Science 101" |

There are twenty-nine keywords in Python:

1 2 3 4 5 |
and def exec if not return assert del finally import or try break elif for in pass while class else from is print yield continue except global lambda raise |

You can still name variables that contain keywords, but they cannot be exactly the name of a keyword.

Like:

1 |
python_class = "Computer Science 101" |

class is a keyword, but since it’s used inside a bigger word, the variable name is legal.

Next thing that we’ll talk about are statements. A statement is a fancy way of saying a line that executes in Python.

print(4) was a statement

x=5 was a statement

Next thing that we’ll talk about are expressions. Anything that evaluates something is called an expression.

1 + 1 is an expression.

We can print these expressions.

1 is an expression.

variables are expressions.

We can print all of those.

Next thing that we’ll talk about are operators. Operators are special symbols like addition and multiplication that perform a computation.

You can do simple math like 1 + 2.

3 * 4. The asterisk symbol is used for multiplication.

Two asterisk symbols are used for exponents. 2 ** 2.

Operators in Python follow the order of operations, which you may remember as parentheses takes priority, and then multiplication and division, and then addition and subtraction.

For instance, you can write (1 + 2) * 3, and the result would be 9 because of order of operations. 1 + 2 happens first, which equals to 3. Then, 3 is multiplied by 3 = 9.

You can use the addition operator on strings to combine strings together. For example,

1 2 3 4 |
topping1 = "pepperoni" topping2 = "mushrooms" pizza = topping1 + " " + topping2 + " pizza" print(pizza) |

The next thing we’ll talk about are comments.

When programs get more complicated, developers leave comments that are basically notes, so that you or future developers understand what you did.

Comments in Python are prefixed by the # (pound) symbol.

For example,

1 2 3 4 5 |
# Number of seconds seconds = 1800 # Number of seconds translated to minutes. minutes = seconds / 60 |

# (pound) symbol is used for single line comments.

For multi-line comments, where you need to include extra notes, you use a pair of triple quotation marks, one set to start the comment and one set to end the comment.

For example,

1 2 3 4 5 |
""" This is a multi-line comment. """ |

**Video Demonstration**

Pingback: http://falschgeldkaufen.blogspot.com/2017/01/wo-kann-ich-falschgeld-kaufen.html()

Pingback: kudzu alcoholism()

Pingback: دانلود قسمت هشتم شهرزاد دوم()

Pingback: دانلود شهرزاد قسمت هفتم فصل دوم()

Pingback: دانلود شهرزاد قسمت دوازدهم فصل دوم()

Pingback: قیمت پنجره()

Pingback: XXX()

Pingback: دانلود قسمت ششم فصل دوم شهرزاد()

Pingback: دانلود قسمت 12 عاشقانه()

Pingback: دانلود قسمت دهم فصل دوم شهرزاد()

Pingback: دانلود قسمت سیزده عاشقانه()

Pingback: Lucia Fernandez()

Pingback: April O'Neil()

Pingback: Bobbi Dylan()

Pingback: Nicole Aniston()

Pingback: Peta Jensen()

Pingback: Mia Malkova()

Pingback: Rachel Starr()

Pingback: دانلود شهرزاد قسمت هفتم فصل دوم()

Pingback: Jada Stevens()

Pingback: lesbian porn()

Pingback: Paleo Diet()

Pingback: Free Stuff Worldwide()

Pingback: backhoe repairs()

Pingback: free online movie()

Pingback: free bonus money casino()

Pingback: دانلود قسمت 12 عاشقانه()

Pingback: پنجره()

Pingback: عاشقانه()

Pingback: دانلود قسمت اول شهرزاد دوم()

Pingback: Hunde skove i DK()