9 Bae or Bust Calculator?

 

This chapter covers

  • Finding the length of a string
  • Using a complex IF statement
  • Combining data from several variables into one string
  • Writing data to text files

BAE (pronounced b.a.y, bay) is a modern-day acronym that stands for before anyone else and is usually used to refer to your girlfriend, boyfriend, or best friend. For example, “I am just waiting for my Bae,” “He’s my Bae,” or simply, “My Bae”. This is such a nice word, but how do you really know if someone is your Bae? If only there was an App that could evaluate the Baeness of your relationship!

WHAT YOU WILL BUILD

Want to know what your BAE score is? Well guess what, in this chapter we are going to build a GUI that does just that! Enter in the name of your potential Bae, then enter your name, click the button and your Baeness score is calculated and displayed. Will it be what you thought it would be? Higher or Lower? (It is worth noting that this GUI is not scientifically accurate and is just for fun!)

Towards the end of the chapter, we will look at how to automatically write and save the results of the BAE calculation, the data to a text file. That is right, you will write some spy style coding which when you press the Calculate button, will create a secret text file, and then write or update the results to that file. You can then share, compare, or just keep the file for future evidence.

Creating the project

Setting up the folder

Importing the modules

Creating the function to calculate the Baeness

Building the main app

Coding the text entry boxes

Coding the submit button.

Displaying the result

Running and testing the BAE calculator

Other things to try

Creating an enhanced version – Displaying levels of Baeness

Creating version two – Saving the results to a text file

Summary