The First Python Code – an advanced calculator

Everyone begins coding with the “Hello World” stuff. We are geologists, so, let’s begin with “Hello Geologists”. Install python and try out some of the most basic yet powerful operations in Python.

I use python as a calculator a lot. Try out some complex functions and explore.

[python]

#The first python code
print (“hello Geologists”)
#–>Hello Geologists

#Input and Outputs are the to most important aspects of programming.
#you can interact with python ith the “input” command (previously raw_input)
name=input(“Enter your name: “)
#You can also print the input value using the print command.
#–>Enter your name: “ab”
print(“You are “, name)
#–>You are “ab”

#Python can be used as a calculator
#my other favorite calculator in R, which also has similar interactive IDE.

#addition
2+2
#–>4
13/3.3
#–>3.9393939393939394

[/python]

Leave a Comment

Your email address will not be published. Required fields are marked *