Isn’t that a snake?!

 

Have you ever heard of the “python”? No. Not the snake okay.

PythonPython is a programming language designed to communicate task in a machine.

x=1
while x!=0:
 pangalan= input ("what is your name?")
 taon= int(input("year of your birth:"))
 tangkad= float(input("height(in cm):"))
 bigat= float(input("weight(in kg):"))
edad= 2014-taon
 bmi= bigat/((tangkad/100)**2)
print("\nhola", pangalan, "!") #\n
 print("you are", edad, "years old")
 print("height (in m): ", tangkad/100)
 print("weight (in kg): ", bigat)
 print("bmi:","%0.2f" %bmi) #"%0.2f" %bmi
if bmi<18.5:
 print("you are underweight. go to mcdo more often")
 elif bmi>= 18.5 and bmi< 22.9:
 print ("so cliche. you are normal -_- ")
 elif bmi>= 22.9 and bmi <27.4:
 print("put down that burger. you are overweight")
 elif bmi>=27.4:
 print("you are chubby")
 x=int (input ("\npress 1 to continue, 0 otherwise:"))

That is exactly what we did. We have to write first in the text editor, and save it with the file extension of “.py” . After that we have to go to “Terminal” the one that looks like the “cmd” of windows. Then run Python. The texts above were the ones written on the text editor.

And this is how it looks like when you use the python:

user@ics-user:~/Desktop$ python3 input.py
what is your name?jona
year of your birth:1996
height(in cm):160
weight(in kg):1
hola jona !
you are 18 years old
height (in m): 1.6
weight (in kg): 1.0
bmi: 0.39
you are underweight. go to mcdo more often
press 1 to continue, 0 otherwise:0 
user@ics-user:~/Desktop$ python3 input.py
what is your name?jona
year of your birth:1996
height(in cm):164
weight(in kg):50
hola jona !
you are 18 years old
height (in m): 1.64
weight (in kg): 50.0
bmi: 18.59
so cliche. you are normal -_-
press 1 to continue, 0 otherwise:0
user@ics-user:~/Desktop$ ^C

I enjoyed our activity, but I am pretty sure that I will much enjoy the animal python! HaHa.

Green_Python_Berlin_Zoo

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s