Skip to main content

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 use of 'FOR LOOP' for counting in Python. In this example, the number (n)  starts at zero and increases to 10. Note that a +1 is need to be added, otherwise the loop will stop at 9.
Result will be :


Other example with different number and counting step,
The 'WHILE LOOP' continues until a certain criteria is met.
There are some situations where 'WHILE LOOP' are more suitable than 'FOR LOOP', usually in less predictable circumstances.
To achieve the incremental steps in counting, change the n+1 to higher number.
To counting in reserve,

Here is an example of 'WHILE LOOP' to keep generating random number until it find intended number.
The operator '!=' means'not equal to' , in other word, keep looping until find the number.

This example below creates something called a 'STRING ARRAY', which a list of separate words stored in variables.



Comments

Popular posts from this blog

Satellite Communication - Part 4 (CPI)

Cross Polar Isolation (CPI) In installation and pointing/peaking antenna, Orthogonal Mode Transducer (OMT) must be set to be as precise as possible to get the best CPI value. above is picture of OMT Feed assembly include with BUC and LNB The minimum value for CPI is 30 dB (better will be good) in Linier Polarized Antennas. The reason is for our receive (Rx)-side as not to get interferenced (distrubed) by other (polarity) Down-Link users, therefore our transmit (Tx) shoild as well not interfere other users that operates at 90 deg (Orthogonal) Polarization. Note : In LH/RH Circular Polarizations, usually CPI of 27dB (=AR of 1.09) is acceptable enough. picture above is careless/miss-aligned OMT setting

Satellite Communication : Transmission Bands

A satellite link is a radio link between a transmitting earth station and receiving earth station through a communications satellite. A satellite link consists of one uplink and one downlink; the satellite electronics (i.e., the transponder) will remap the uplink  frequency to the downlink frequency. The transmission channel of a satellite system is a radio channel using a direct-wave approach, operating in at specific RF bands within the overall electromagnetic spectrum as seen below : The table below shown some key of physical parameters of relevance to satellite communication,  The frequency of operation is in the super high frequency (SHF) range (3-30 GHz). Regulation and practice dictate the frequency of operation, the channel bandwidth, and the bandwidth of the subchannels within the larger channel. Different frequencies are used for the uplink and for the downlink. Frequencies above about 30 MHz can pass through the ionos...

High Throughput Satellite Service - more than modems and transmission

The advent of High Throughput Satellite (HTS) has been significant amount of new satellite capacity come online in recent years, prompting industry-wide disruptive innovation. This lower cost capacity enables a new era of satellite communications, with innovative new applications spreading around the world. However, there are a number of factors that must be considered for the operation of a successful HTS service. The satellite industry is undergoing a dramatic evolution as more and more High Throughput Satellite (HTS) capacity is introduced to markets around the world, like Intelsat Epic , Inmarsat Global Express , Viasat-2 , SES-12 ,etc. HTS is bringing more and lower-cost capacity that enables the satellite industry to cost-effectively provide large-scale internet services to rural and other hard-to-serve areas around the world. To enable these services, many providers are focusing on selecting the optimal ground system, and rightly so, because the ground system is a key e...