

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Python is a high-level programming language, with applications in numerous areas, including web programming, scripting, scientific computing, and artificial intelligence. The three major versions of Python are 1.x, 2.x and 3.x. These are subdivided into minor versions, such as 2.7 and 3.3. Code written for Python 3.x is guaranteed to work in all future versions. Both Python Version 2.x and 3.x are used currently. This course covers Python 3.x, but it isn't hard to change from one version to another. Python has several different implementations, written in various languages. The version used in this course, CPython, is the most popular by far. FLOATS Floats are used in Python to represent numbers that aren't integers. Some examples of numbers that are represented as floats are 0.5 and -7.8237591. They can be created directly by entering a number with a decimal point, or by using operations such as division on integers. Extra zeros at the number's end are ignored. Before I tried the tutorials, I had some ideas on what programming really is. As for learning Python 3, my fore knowledge was only to do print("Hello, World!"); which is familiar for us since we had our programming lessons in c++, but in Python it uses the print function. Upon learning the basics, I have encountered the concepts of the if, else, loop, while loop and the operations in which some of them are already being discussed on some programming language with respect to its function, concept and logic. In Python, decision making is also an integral part as to the flow of the interpretation of the codes. Decision making is required in Python especially when we want to execute a code only if a certain condition is satisfied. “If-else” perhaps is one function that uses the true and false relationship, the basic concept of it is that when the statement is false then it is not executed, treated as none or 0 (zero). A flowchart perhaps could explain the logic flow of it. The for loop in Python is used to iterate over a sequence (list, tuple, string) or other iterable objects. Iterating over a sequence is called traversal. Loop continues until we reach the last item in the sequence. The body of for loop is separated from the rest of the code using indentation.
While, the “loop” function is used to repeat or reiterate over the series or the sequence of the objects. I have discovered that the main idea of a loop is that a loop continually functions until the last object in the series has been reached. An important note in using loop in Python is that it is separated from the rest of the code by putting the indentation. The while loop in Python is used to iterate over a block of code as long as the test expression (condition) is true. We generally use this loop when we don't know beforehand, the number of times to iterate. Also an important function of loop is the “for” and “while” loops. “While” loops, according to the videos I’ve watched and some external sources like Solo Learn, are loop functions that is used to reiterate over a block of code or a group of code in which the condition must be put to test, generally used when the programmer doesn’t have an idea on how many times a loop is going to be reiterated. FUNCTIONS In Python, function is a group of related statements that perform a specific task. Functions help break our program into smaller and modular chunks. As our program grows larger and larger, functions make it more organized and manageableyword def marks the start of function header. A function name to uniquely identify it. Function naming follows the same rules of writing identifiers in Python.Parameters (arguments) through which we pass values to a function. They are optional.A colon (:) to mark the end of function header.Optional documentation string (docstring) to describe what the function does.One or more valid python statements that make up the function body. Statements must have same indentation level (usually 4 spaces).An optional return statement to return a value from the function.. Functions in general, are helpful tools in programming that makes the codes shorter and reusable as to how it breaks the program into smaller chunks of codes. It makes the program lesser complicated and arranged. Some most commonly used functions that or syntax that I’ve encountered are “def: where start of a function starts and used in function naming, the colon : to end the function header, indentation and return statements to return a value from the function. Python supports integers, floating point numbers and complex numbers. They are defined as int, float and complex class in Python. Integers and floating points are separated by the presence or absence of a decimal point. 5 is integer whereas 5.0 is a floating point number.Complex numbers are written in the form, x + yj, where x is the real part and y is the imaginary part. Moreover, most in programming languages give emphasis on “Data Types”. In python, there are quite a number of data types that needs to be considered, one of which are Number Data Types. According to the references, Python supports integers, complex numbers and float type- defined as “int”, “complex”, and “float” class respectively.