# In-depth Blog Post #4

Between now and the last post, I’ve focused more on the hands-on portion of in-depth. The first few weeks of in-depth are similar to learning phases where we dont really know what we are getting into but now, the whole process becomes more and more fleshed out. I finished the udemy course Automate the Boring Stuff with Python and started moving on to my calculator.

The calculator is a program that can be made fairly easily as a beginner. Python is a programming language that is well-versed in terms of its logical and data processing “skills”. So it’s no surprise that a calculator would be easy to make since it takes the basics of the language and makes itself into a tool that we humans can use. Some of the simplest variables are ones that define variables, add, subtract, multiply, and divide. Using almost only these variables, I can create a simple calculator:

def add(x, y):
return x + y

def subtract(x, y):
return x – y

def multiply(x, y):
return x * y

def divide(x, y):
return x / y

print(“Select operation.”)
print(“1.Add”)
print(“2.Subtract”)
print(“3.Multiply”)
print(“4.Divide”)

choice = input(“Enter choice(1/2/3/4): “)

num1 = float(input(“Enter first number: “))
num2 = float(input(“Enter second number: “))

if choice == ‘1’:
print(num1,”+”,num2,”=”, add(num1,num2))

elif choice == ‘2’:
print(num1,”-“,num2,”=”, subtract(num1,num2))

elif choice == ‘3’:
print(num1,”*”,num2,”=”, multiply(num1,num2))

elif choice == ‘4’:
print(num1,”/”,num2,”=”, divide(num1,num2))
else:
print(“Invalid input”)

If you put that into a program like Notepad and save as a .py file, then you can run the program; if you have python.

So it isn’t too difficult to make a calculator. Although, my calculator currently has more functions than the ones above. I also input advanced functions such as sine cosine and tangent. What makes this project difficult is the front-end. Displaying the calculator in a appealing manner in my website. As I said before in my last post, python mostly focuses on back-end, which is the brains. It’s a language that renders on the server side of a program or website. In the calculator program above, it requires you to input numbers without buttons. It works, yes, but it isn’t really aesthetic enough.

For aesthetics, I need to work on my front-end skills. My mentor suggest JavaScript and from what I can gather, learning JS can be useful not only for the front-end part of my calculator, but also my website. JS is the program that puts the add function as a button instead of a ‘choice’. For the website, it can make components of the website move and interact so it’s a seamless experience for the user. An example of this is the website ‘simplychocolate.dk’. The pages are made to look like one which just makes for a better website.

1. What has been my most difficult mentoring challenge so far? Why?

A challenge that we have faced is the global pandemic right now. Last meeting I had with James, we had established that on the next meeting, James would help me set up a https server. Since we can’t meet in person, we can’t do it. The plan was to just take a previous server James had made and basically just emulate that one. However, we did get through this obstacle with the power of Discord. Discord is an application much like Skype where we can video call and chat. One key component of Discord that helped us get through this is screenshare. What this allows us to do is look at the other person’s screen by sharing it.

2. What is working well? Why?

The resource that I chose, the udemy course worked well. I have finished but what makes the course especially useful is how much I can go back to it. When I first went through the course, I guess I can say I learned python. But not really. I went through the lessons and exercises, but the information didn’t really stick. It was more so an experience of learning ABOUT it. However, when the resource really shined was when I went back to it for help. Help that I needed when using python for my own lines of code (or little tests/experiments). That is where I really learned how python works, when I had no guidance. When I struggled or when a syntax error occurred, I consulted the resource and so far it has been working well.

3. What could be working better? How can you make sure this happens?

Hopefully this whole pandemic situation becomes controlled soon. It’s not only affecting in-depth but also the whole world on an unbelievable level, probably more than I think it is. But I have no control over anything but myself so I can only do what is in my control. Regarding my website, I need to learn JS and maybe also HTML and CSS for building the website. James has already sent me some resources for it and I’ve started working on them. However, there seems to be a lot more to learn that I initially thought. The first resource I will be learning from is Codecademy, which is a resource I had considered for python. I also tried finding a udemy course but most of them were pretty expensive so I opted out of that. I better get started then.

Advertisement