Skip to main content

Posts

Showing posts with the label IT

Getting Started With Python (4) - Mathematics's Order, Comparison, and Logical of Operation

Order of Operations In mathematics operation, we should solve it in the following order : parentheses, exponents, multiplication, division, addition, and subtraction; which known as PEMDAS. It is important to know the proper order as it crucial for getting the correct answers when coding programs. where such operations are performed. Let's try using IDLE : Enter the following command :                         5+3*2 When you press ENTER , the result is 11. It is obvious that multiplication part comes first (3*2) and then adding 5, which result is 11. Let's try again with open another file from IDLE. On above examples there are two kind, which are : 5-3*2 and (5-3)*2 The results of the two statements above will be : Let's try other examples with exponent : There are two additional examples using exponential, 5^3*2 and 5^(3*2). The result between that two are : Comparison Operation We will try to...

Getting Started With Python (3) - Mathematics Operation

In this section, we will do some work on mathematical operation which are multiplication, division, addition, subtraction, modulus, exponent, and floor division . You might want to look at my previous post , it has some example of mathematics operations (arithmetic and algebra). On the editor window of Python, enter the following : a=35 b=22.78  Let's add these a and b together using the addition operator. For the recommendation practice, may we add a comment before the lines of code  #Addition print(a+b) print() Using subtraction operation : #Subtraction print(a-b) print() Save the file, run the module ( Run>Run Module ) or press F5 . The output will be : Next, we go with multiplication and division : #Multiplication print(a*b) print() #Division print(a/b) print() Save the file and run the file again, you will get the following output : Other operation that we will try is modulus , which is denoted by % sign. Modulus oper...

Getting Started With Python (1)

As per addition on my previous post on Python Basic Programming , I want to add how to download and install Python, running it, and create basic Python program. Download and Install Python You can visit official Python website,  https://www.python.org/ . The latest version, as per October 2018 is Python 3.7.1rc2 and I think it is advisable to start learning using latest version to avoid any problems with older, legacy version. Python officially release version on many platforms, like Windows, Linux, Mac OS, and iOS. Run IDLE (Integrated Development and Learning Environment) Python With this IDLE, let's start writing Python program :  Click File , then New File . We can also press Ctrl+N . A blank editor window will open. That is for us write the code.           Enter the following commands on separate lines :           print("Hello World")           print("Welcome to Python for Beg...

PYTHON BASIC PROGRAMMING

These are some examples on basic commands and programming methods in Python. N.B : I did it on my Raspberry Pi 3 and written on on Python 3 To putting text into the screen : The # hash symbol means comment and Python will ignore everything that written after the hash - it is a way to add notes, reminder, or heading. Result will be : Arithmetic : We can put two print commands into the same line using a ; semicolon. The second print command gives a line space between each equation. You will notice that the answer for division sum includes decimal place. Result To remove the the decimal, we can use ' INT ' function and answered number will be rounded to the nearest whole number, With variables, we can get our program remember numbers and words, which we can use later. and the result will be : Variables can be words which called 'strings' because they are string of alphanumeric strung together. Result will be : The ...

> P R O G R A M M I N G

Computer programming or 'coding' is a method of getting a computer to perform tasks, such as displaying and processing information, creating games and applications or controlling devices, motors or robots. The computer can interpret our commands through programming languages, which help to make the processes of instructing the computer easier. When we 'run' a computer program, the computer starts to carry out our instructions step by step and reacts to 'events'. We can tell the program how it should deal with certain events. For example, your program might be instructed to sense events such as a certain key being pressed on the keyboard, a click of the mouse on a button, and how it should react to these events.