Example Program Input & Output in Python

Hi

Hi, This time i want to share How to create Input and Output using the Python language, immediately wrote i love the examples of input and output with ease so that you can learn it.

Input Integer

bil1 = int(input('Masukan Bilangan ke-1 = '))
bil2 = int(input('Masukan Bilangan ke-2 = '))
 
print("")
print("Dan Hasilnya Adalah..")
print("")
 
tambah = bil1+bil2
kali =  bil1*bil2
print("Hasil tambahnya adalah = ", tambah)
print("Hasilnya perkaliannya adalah = ", kali)

Explanation on program example above:

Make An Input and output, you just need to type in the editor or IDLE python Pycharm you.

VARIABEL --> bil1, bil2, tambah, kali
INPUT BILANGAN --> int(input('Masukan Bilangan ke-2 = '))
PERHITUNGAN --> tambah = bil1+bil2
OUTPUT --> print("Hasil tambahnya adalah = ", tambah)

count Volume Radius

r = int(input('jari jari ='))
t = int(input('tinggi ='))
 
phi = 3.14
 
volume = 1/3*phi*r*2**t
print('volume', volume)

Explanation on program example above:

Make An Input and output, you just need to type in the editor or IDLE python Pycharm you.

VARIABEL --> r, t, phi, volume
INPUT BILANGAN --> int(input('jari jari ='))
PERHITUNGAN --> volume = 1/3*phi*r*2**t
OPERATOR --> / (Pembagian), * (Perkalian)
OUTPUT --> print('volume', volume)

Salary calculation

nama = input("Masukan Nama Anda = ")
jabatan = input("Masukan Jabatan Anda = ")
gaji = int(input("Masukan Gaji Anda = "))
pajak = 10/100*gaji
 
print()
print("Pegawai dengan nama", nama, "dan jabatan", jabatan, "\ndengan gaji", gaji, "harus membayar pajak sebesar", pajak)

Explanation on program example above:

Make An Input and output, you just need to type in the editor or IDLE python Pycharm you.

VARIABEL --> nama, jabatan, gaji, pajak
INPUTAN BILANGAN --> int(input("Masukan Gaji Anda = "))
PERHITUNGAN --> 10/100*gaji
OPERATOR --> / (Pembagian), * (Perkalian)
OUTPUT --> print("Pegawai dengan nama", nama, "dan jabatan", jabatan, "\ndengan gaji", gaji, "harus membayar pajak sebesar", pajak)

Creating Tuple Day

hari = int(input("Masukan Hari = "))
list_hari = ["Senin","Selasa","Rabu","Kamis","Jumat","Sabtu","Minggu"]
 
print(list_hari[hari-1])

Explanation on program example above:

Make An Input and output, you just need to type in the editor or IDLE python Pycharm you.

VARIABEL --> hari, list_hari
INPUT BILANGAN --> int(input("Masukan Hari = "))
TUPLE --> ["Senin","Selasa","Rabu","Kamis","Jumat","Sabtu","Minggu"]
OUTPUT --> print(list_hari[hari-1])

Candy program

input_permen = int(input("Masukan Jumlah Permen = "))
permen = 3
 
print()
print("Kantong Plastik nya = ", input_permen//permen)
print("Sisa Permennya =", input_permen%permen)

Explanation on program example above:

Make An Input and output, you just need to type in the editor or IDLE python Pycharm you.

VARIABEL --> input_permen, permen
INPUT BILANGAN --> int(input("Masukan Jumlah Permen = "))
OPERATOR --> % (Sisa Bagi), // (Hasil Bagi)
OUTPUT --> print("Kantong Plastik nya = ", input_permen//permen)

Source Code?

You guys please check on this site:

– https://github.com/poncoe/python_basic/tree/master/bab1_input_output
– https://github.com/poncoe/python_basic

Post Author: Study