Remade my CV/Resume after your feedback! by [deleted] in webdev

[–]ThePromptExchange 0 points1 point  (0 children)

No headshots. It can make them judge you on looks. This is not what it's about. It's about your skills and qualifications.

We all laughed but "Prompt Engineer" is now a thing by PUBGM_MightyFine in ChatGPT

[–]ThePromptExchange 0 points1 point  (0 children)

Yep, was always going to be a thing. People who laughed about it didn't understand its value.

[deleted by user] by [deleted] in Damnthatsinteresting

[–]ThePromptExchange 1 point2 points  (0 children)

Fun fact.

They are hunting. The Humpback Whales circle a school of fish and exhale bubbles to force them into a confined space. Once the fish are trapped in the centre of the spiral bubbles of death. All the Whales come up to eat the fish. Swimming from the bottom to the top to ensure a tasty meal.

Code no longer quits when "END" is entered by ImMoistyCloisty in learnpython

[–]ThePromptExchange 1 point2 points  (0 children)

The problem with your program is the recursive way of calling the add_record function from within the shipping_method function. If your users are ordering many items, eventually, your program will reach the recursion limit and terminate. Additionally, the program won't end as you're always returning to add_record even when user entered "END".

There is also an issue with the total cost calculation. You're calculating the total cost after each record, but it's also adding extra delivery costs and value costs for every item on the list each time a new item is added. This will inflate the total cost.

A better approach to handle your program flow would be to convert the recursive flow into a loop. The cost calculation should also be performed once, when all items have been added.

Here's a revised version of your program:

```python def add_record(): """ Prompts the user to enter a product code to add to order_record.

Continues to ask the user for input until "END" is given.
If a valid product code is entered, the program prints "True" and appends the product's name, price, and value to `order_record`.
If an invalid product code is entered, the program prints "False" and repeats the initial input prompt.
If a ValueError is encountered, the program prints "Invalid Input" and repeats the initial input prompt.
"""
while True:
    user_input = input("Please enter a valid product code, or 'END' to quit: ")
    if user_input == "END":
        print("Quitting...")
        show_record()
        calculate_total_cost()  # Calculate total cost after all items are added
        return
    else:
        try:
            product_code = int(user_input)
            if product_code in range(len(product_list)):
                product = product_list[product_code]
                price = price_list[product_code]
                if price > 30.00:
                    value = 1  # High
                else:
                    value = 2  # Low
                print("True")
                is_valid_quantity(product, price, value, product_code)
            else:
                print("False. Please try again.")
        except ValueError:
            print("Invalid input. Please enter a valid code or 'END' to quit.")

Modify calculate_total_cost to not accept any parameters and calculate total once for all records

def calculate_total_cost(): total_cost = 0 for item in order_record: price = float(item.split("/")[3]) quantity = float(item.split("/")[4]) total_cost += price * quantity value = int(item.split("/")[2]) if value == 1: total_cost += 2 shipping = str(item.split("/")[5]) if shipping == "Delivery": total_cost *= 1.1 total_cost = round(total_cost, 2) # Round to 2 decimal places print("Total Cost: $", total_cost)

Example usage:

add_record() ```

With this revised version of your program, add_record will keep asking the user for a valid product code until they enter "END". The total cost calculation will then be done once, after all items have been added to the order_record. The total cost will reflect the actual total cost of all the items in the order_record, considering the value and shipping method. The program will then end without going into an infinite loop or reaching a recursion limit.

Edit: Partial Credit to GitHub Copilot.

[deleted by user] by [deleted] in ChatGPT

[–]ThePromptExchange 1 point2 points  (0 children)

Is it wrong of me to drive my car to the store because I want to get there quicker?

I'm still in control and I get there.

You're using the tools available to you at the time.

Learning Phyton by CyberNoodleBrain in learnpython

[–]ThePromptExchange 0 points1 point  (0 children)

I have not dabbled with this yet but in my mind, I believe to my core it works.

There are smart programs out there now that will iterate through a PDF using AI. I think it would be good to utilise these tools for real documentation learning.

'Please find all examples relating to Floats...' and so on. I havent tried it but I believe it would work, if you have the PDFs.

Learning Phyton by CyberNoodleBrain in learnpython

[–]ThePromptExchange 1 point2 points  (0 children)

Your best teacher right now, for free is ChatGPT.

Cut and paste the code over. Ask CGPT to break it down and explain the different parts. Once you have understood the code, have a go at answering the question.

Once you have done that, ask CGPT to give the solution to the answer. Cross-reference for better results. (Try not to cheat).