Skip to main content

Getting Started With Python (2) - Output of Print() function

After doing the installation and try on familiarize with IDLE Python and editor window, in this post, let's try to dig deep on print() function.

Run the IDLE,

Enter the following command :
     print("Anityo Nugroho")

The result will be :
     Anityo Nugroho

Next :
     print("Anityo Nugroho","engineer")
The result will be :
     Anityo Nugroho engineer

Another example which is variable :
     blog="Beginner in Python"
     print(blog)
The result will be :
     Beginner in Python

The above example in IDLE :

Let's combine variable with another string :
     print(blog,"Anityo Nugroho")
The result output will be :
     Beginner in Python Anityo Nugroho

Next, to try the output using integer :
     print(25)
It will give the output :
     25

Other example using decimal number :
     print(358.22458)
Result will be :
     358.22458



There is a difference in Python when we use strings and number for print() function. Number, can be entered without quotation marks and also strings in the form of variable.

Separator
Let us try some examples on separator :
     print("Anityo","Nugroho","Graham","Aker"); print()
     print("Anityo","Nugroho","Graham","Aker",sep="\t"); print()
     print("Anityo","Nugroho","Graham","Aker",sep="|"); print()
     print("Anityo","Nugroho","Graham","Aker",sep=""); print()
   
The output will be :

the second print() on every line added using a ; semicolon, to gives a line space between each equation.
The different between the first and second example, with sep="\t" as separator, output of the following names with a tab between each name.

It is the same if we apply on numbers, example :
     print(12,24,36,48,sep="**")
It will give the output :  
     12**24**36**48

Other separator that like to try is \n
Example :
print("Python","\n","Beginner Walk","\n","year 2018","\n"); print()
print("Python","Beginner Walk","year 2018",sep="\n"); print()


it will give output :

To avoid spaces between output (like on example 1), addition of \n as separator just once in the code (example 2).

Let's work with output on both string and number :
Example :
print("Anityo Nugroho,38"); print()
print("Anityo Nugroho",38); print()

Result will be :

The following codes to make a good quote :

The output will be :









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...

Satellite Communication - Part 1

In this occasion, i want to share about Satellite communication. First, please look at the picture below, Planets of our Solar System God created Moon as our Earth satellite. In order to broading our communication, people tend to use artificial satellite for communication. Based on orbits, these are the type of satellites : Low Earth Orbit (LEO)              Height : 750-2500 Km,       Period : 2 - 2.5 hours Medium Earth Orbit (MEO)       Height : 7500-10000 Km,   Period : 4.5 - 6 hours High Earth Orbit (HEO)             Height : 15000-20000 Km, Period : 11-12 hours Geo-Stationary Orbit (GSO)      Height : 36000 Km,             Period : 24 hours Incline Orbit Satellite (drifting > 0.1 deg. N-S an...