Hi fellow coders.
I have encounter yet another dead end with my code in the following exercise:
All of the first steps have been tested and worked. However for the last step I am having issues, the result keeps printing the premium cost no matter what weight I chose.
You are comparing ground, drone and premium. All of those are strings.
You’d rather want to compare the different costs, right?
Yes I want to compare and return the cheapest cost depending on weight input.
@barelyhere has pointed you in the right direction, by pointing out that for your variables
Does it make logical sense for a cost to be a string type?
I makes no sense att all, thank you for that reminder.
I think however the reason they were in “str()” was because all the ground & drone functions were set as string because I added a print statement with a string and I needed to concatenate the strings and the interger result.
Anyhow, thank you again.
So, you’re not using printf style formatting?
the_number = 3
the_quote = "First shalt thou take out the Holy Pin. Then shalt thou count to %s, no more, no less. %s shall be the number thou shalt count, and the number of the counting shall be %s." % (the_number,the_number,the_number)
First shalt thou take out the Holy Pin. Then shalt thou count to 3, no more, no less. 3 shall be the number thou shalt count, and the number of the counting shall be 3.
(Yes, I know I’m repeating myself… but three is the number, after all…)
No I wasn’t, I know in the tutorial video it was shown. But I have no recollection that it was ever taught in the lessons so I skipped it
It’s definitely included in the Python 2 course, but I haven’t done the Python 3 one so can’t say for certain it’s in there.
Would be surprising if it’s not, it’s quite useful…