gpt-3.5-turbo-0613· openai
Suzhen/CodeChat
write simple cafe app?
- User
write simple cafe app?
- Assistant
Sure! Here is an example of a simple cafe app written in Python:
pythonmenu = { 'coffee': 3.50, 'tea': 2.50, 'sandwich': 5.00, 'cake': 4.00 } def display_menu(): print("Menu:") for item, price in menu.items(): print(f"{item}: ${price}") def place_order(): order = [] while True: item = input("Enter item name (or 'done' to finish ordering): ") if item == 'done': break if item not in menu: print("Sorry, that item is not available.") else: order.append(item) return order def calculate_total(order): total = 0 for item in order: total += menu[item] return total def main(): display_menu() order = place_order() total = calculate_total(order) print(f"Total: ${total}") if __name__ == '__main__': main() - User
write html code simple cafe app?
- Assistant
Sure! Here is an example of HTML code for a simple cafe app:
html<!DOCTYPE html> <html> <head> <title>Simple Cafe App</title> </head> <body> <h1>Welcome to the Cafe!</h1> <h2>Menu:</h2> <ul> <li>Coffee - $3.50</li> <li>Tea - $2.50</li> <li>Sandwich - $5.00</li> <li>Cake - $4.00</li> </ul> <h3>Place Your Order:</h3> <form action="order.php" method="post"> <label for="coffee">Coffee:</label> <input type="number" name="coffee" id="coffee" min="0"><br> <label for="tea">Tea:</label> <input type="number" name="tea" id="tea" min="0"><br> <label for="sandwich">Sandwich:</label> <input type="number" name="sandwich" id="sandwich" min="0"><br> <label for="cake">Cake:</label> <input type="number" name="cake" id="cake" min="0"><br> <input type="submit" value="Place Order"> </form> </body> </html>