(Python-3.x) My Sal’s Shipping challenge on Codecademy beginner attempt

This is my attempt on the Python 3 Sal’s Shipping challenge on Codecademy (Challenge Link(instructions in the link)).
I’d really appreciate anyone to take the time to review my code. I’m a very fresh newbie and I really wanna improve my coding, all feedback is appreciated, thankss :).

def groundCost(weight):   if weight > 10:     cost = weight * 4.75   elif weight > 6:     cost = weight * 4   elif weight > 2:     cost = weight * 3   else:     cost = weight * 1.5   cost += 20   return cost  def droneCost(weight):   if weight > 10:     cost = weight * 14.25   elif weight > 6:     cost = weight * 12   elif weight > 2:     cost = weight * 9   else:     cost = weight * 4.5   return cost  def costCalc(weight):   g = groundCost(weight)   p = 125   d = droneCost(weight)   gS = "Ground Shipping"   pS = "Premium Ground Shipping"   dS = "Drone Shipping"   if d == g or d == p or g == p:     if d == g and d == p:       print("All shipping methods cost $  125 according to your items weight")       return      if d == g:       same1 = dS       same2 = gS       cost = d     if d == p:       same1 = dS       same2 = pS       cost = d     if g == p:       same1 = gS       same2 = pS       cost = g     print("Youre cheapest shipping method is "+same1+" and "+same2+" as they both cost $  "+str(cost))     return   elif (g < d) and g < p:     cheapMeth = gS     cost = g   elif (p < d) and p < g:     cheapMeth = pS     cost = p   elif (d < g) and d < p:     cheapMeth = dS     cost = d   print("Youre cheapest shipping method is "+cheapMeth+" costing $  "+str(cost))   return weight = int(input()) costCalc(weight) 

Example of beginner, intermediate, advanced components [on hold]

Similar to this other question An example of a beginner-level Algorithm, intermediate level Algorithm and a complex/expert level Algorithm? What would be examples of beginner, intermediate and advanced components?.

For example implementing a connection pool would be beginner or intermediate? what about implementing a thread executor or a dependency injector? Although these components are very well implemented in libraries, I think the question would be useful for people to know them and get familiar to understand how to use them and what to expect from them.

Va Business – Propel Your Brand Upwards – Make 800$ per day – Work From Home – Beginner Friendly

HOW IT WORKS

VIRTUAL ASSISTANT RESELLER SITE

No headaches completely outsourced. Virtual Assistant & Social Media Posting Service is completed by the Suppliers included with the sale of this website.

Very reliable Suppliers with a proven track record, together with 4 backup Suppliers.

This site runs on Autopilot if you have reasonable communication skills. No Phone contact with Customers is required. Just forwarding emails. No Skype Calls, just Skype Text Chat or exchange of…

Va Business – Propel Your Brand Upwards – Make 800$ per day – Work From Home – Beginner Friendly

Beginner text adventure game

I am new to Python and I have not yet done any OOP. I wrote this text adventure as a first project and I would like to know if there is a better and more efficient way to write my code within its current paradigm. Any suggestions or critique are more than welcome.

The code is quite long. I don’t expect anyone to read all of it.

#!/usr/bin/env python  import cmd import random import time import sys import os   #### Effects ####  def print_slow(str):     for letter in str:         sys.stdout.write(letter)         sys.stdout.flush()         time.sleep(0.1)     print("\n")  def load_effect(str):     for letter in str:         sys.stdout.write(letter)         sys.stdout.flush()         time.sleep(0.5)   #### Title Screen ####  def menu():     print("\n")     print("SHADOWS OVER LAURENDALE")     print("Version 1.0")     action = input("> ")     if action.lower() == "p":         intro()     elif action.lower() == "q":         sys.exit()     elif action.lower() == "i":         info_menu()     elif action.lower() == "h":         help_menu()     while action.lower() not in ['p', 'q', 'i', 'h']:         print("Invalid option! Enter 'p' to launch the game,")         print("'q' to quit, 'i' for info, or 'h' for help.")         action = input("> ")         if action.lower() == "p":             intro()         elif action.lower() == "q":             sys.exit()         elif action.lower() == "i":             info_menu()         elif action.lower() == "h":             help_menu()   def info_menu():     print("www.shadows-over-laurendale.github.io")     action = input("> ")     if action.lower() == "p":         intro()     elif action.lower() == "q":         sys.exit()     elif action.lower() == "i":         info_menu()     elif action.lower() == "h":         help_menu()     while action.lower() not in ['p', 'q', 'i', 'h']:         print("Invalid option! Enter 'p' to launch the game,")         print("'q' to quit, 'i' for info, or 'h' for help.")         action = input("> ")         if action.lower() == "p":             intro()         elif action.lower() == "q":             sys.exit()         elif action.lower() == "i":             info_menu()         elif action.lower() == "h":             help_menu()  def help_menu():     print("Enter commands to interact with the world.")     print("For more info and a list of commands, consult the manual.")     action = input("> ")     if action.lower() == "p":         intro()     elif action.lower() == "q":         sys.exit()     elif action.lower() == "i":         info_menu()     elif action.lower() == "h":         help_menu()     while action.lower() not in ['p', 'q', 'i', 'h']:         print("Invalid option! Enter 'p' to launch the game,")         print("'q' to quit, 'i' for info, or 'h' for help.")         action = input("> ")         if action.lower() == "p":             intro()         elif action.lower() == "q":             sys.exit()         elif action.lower() == "i":             info_menu()         elif action.lower() == "h":             help_menu()   #### Player ####  player_health = 100 player_inventory = ["Map"] player_gold = 50   #### Main Scenes ####  def intro():     print("\n")     load_effect("...loading...")     print("\n")     print_slow("'Wake up, Arris...'")     print_slow("'You've been sleeping all day!'")     print_slow("'Why don't you go outside and do something?'")     print_slow("'It's so lovely today. Be back for dinner!'")     print("\n")     print_slow("'Okay...'")     print("\n")     village()   def village():     global player_gold     global player_health     print("\n")     print("You are in the village.")     while True:         action = input("> ")         if action == "1":             river()         if action == "2":             farmlands()         elif action == "3":             forest()         elif action == "4":             shop()         elif action == "5":             home()         elif action == "h":             print("Health:",player_health)         elif action == "i":             print("Inventory:")             for items in player_inventory:                 print(items)         elif action == "g":             print("Gold:",player_gold)         elif action == "m":             print("Map: the river(1), the farmlands(2), the forest(3), the shop(4), home(5).")         elif action == "e":             print("Sounds of laughter and loud conversation can be heard in this lively village.")             print("What a lovely place! I was born here and my heart will always be here...")         elif action == "t":             print("A merchant on the street waves you over to where he is.")             print("'Care for some fresh bread, young man? It's only 5 gold.' He asks.")             print("You have",player_gold,"gold.")             print("Yes(y) or no(n)?")             action = input("> ")             if action == "y":                 if "Bread" in player_inventory:                     print("Looks like you already have some bread, kid!")                     print("Eat it up and come back... Hehe.")                 elif player_gold >= 5:                     player_inventory.append("Bread")                     player_gold -= 5                     print("'Here you go!'")                     print("You take the bread from the man.")                 elif player_gold < 5:                     print("Sorry you don't have enough! Ask your mother for a little gold! Hehe.")             elif action == "n":                 print("Okay. Maybe next time!")             else:                 print("Invalid command! Try again.")                 action = input("> ")                 if action == "y":                     if player_gold >= 5:                         player_inventory.append("Bread")                         player_gold -= 5                         print("'Here you go!'")                         print("You take the bread from the man.")                     elif player_gold < 5:                         print("Sorry you don't have enough! Ask your mother for a little gold! Hehe.")                 elif action == "n":                     print("Okay. Maybe next time!")          else:             print("Invalid command! Try again.")   def river():     global player_gold     global player_health     print("\n")     print("You are by the river.")     while True:         action = input("> ")         if action == "1":             village()         elif action == "2":             farmlands()         elif action == "3":             forest()         elif action == "h":             print("Health:",player_health)         elif action == "i":             print("Inventory:")             for items in player_inventory:                 print(items)         elif action == "g":             print("Gold:",player_gold)         elif action == "m":             print("Map: the village(1), the farmlands(2), the forest(3).")         elif action == "e":             print("I can hear the water flowing gently and the birds are singing...")             print("A small boy is out here with his fishing net.")         elif action == "t":             print("The little boy with his net look over at you.")             print("'Have you ever tried crossing this river?'")             print("'It looks so beautiful on the other side.'")             print("'I better get back to catching the fishes.'")             print("'My papa will be proud!'")             if "Raft" in player_inventory:                 print("/n")                 print("Will you cross the river? Yes(y) or no(n)?")                 action = input("> ")                 if action == "n":                     print("That river looks dangerous anyways...")                     print("It's infested with snakes.")                 elif action == "y":                     outskirts()                 else:                     print("Invalid command! Try again.")                     action = input("> ")                     if action == "n":                         print("That river looks dangerous anyways...")                         print("It's infested with snakes.")                     elif action == "y":                         outskirts()         else:             print("Invalid command! Try again.")   def farmlands():     global player_gold     global player_health     global ruby_saved     print("\n")     print("You are in the farmlands.")     while True:         action = input("> ")         if action == "1":             village()         elif action == "2":             river()         elif action == "3":             forest()         elif action == "h":             print("Health:",player_health)         elif action == "i":             print("Inventory:")             for items in player_inventory:                 print(items)         elif action == "g":             print("Gold:",player_gold)         elif action == "m":             print("Map: the village(1), the river(2), the forest(3).")         elif action == "e":             print("Rosy red tomatoes and evergreen lettuce are growing from the ground...")             print("A farmer waves to you and smiles.")         elif action == "t":             print("'Have you seen my lovely Ruby?' The farmer asks.")             print("'She's run away again.'")             print("He looks very concerned.")         else:             print("Invalid command! Try again.")   def forest():     global player_gold     global player_health     print("\n")     print("You are in the forest.")     while True:         action = input("> ")         if action == "1":             village()         elif action == "2":             river()         elif action == "3":             farmlands()         elif action == "h":             print("Health:",player_health)         elif action == "i":             print("Inventory:")             for items in player_inventory:                 print(items)         elif action == "g":             print("Gold:",player_gold)         elif action == "m":             print("Map: the village(1), the river(2), the farmlands(3).")         elif action == "e":             print("This is a far way from home...")             print("The sound of a girl screaming can be faintly heard.")             print("I'm afraid to go on.")             if "Sword" in player_inventory:                 print("\n")                 print("But I do have a weapon to protect myself.")                 print("Shall I go on? Yes(y) or no(n)?")                 action = input("> ")                 if action == "n":                     print("I won't go any further...")                 elif action == "y":                     forest_two()                 else:                     print("Invalid command! Try again.")                     action = input("> ")                     if action == "n":                         print("I won't go any further...")                     elif action == "y":                         forest_two()         elif action == "t":             print("There's no one to talk to here...")         else:             print("Invalid command! Try again.")   #### Sub Scenes ####  def home():     global player_gold     global player_health     print("\n")     print("You are at home.")     while True:         action = input("> ")         if action == "1":             village()         elif action == "2":             river()         elif action == "3":             farmlands()         elif action == "4":             forest()         elif action == "h":             print("Health:",player_health)         elif action == "i":             print("Inventory:")             for items in player_inventory:                 print(items)         elif action == "g":             print("Gold:",player_gold)         elif action == "m":             print("Map: the village(1), the river(2), the farmlands(3), the forest(4).")         elif action == "e":             print("A warm fire is crackling in the hearth...")             print("Something smells delicious!")         elif action == "t":             print("You call for your mother.")             print("She comes inside from the back door and smiles.")             print("'There you are! Now what have you been up to?'")             if player_health < 100:                 print("\n")                 print("'You're hurt! Let me tend to your wounds.'")                 player_health = 100                 print("You feel better. You now have",player_health,"health.")         else:             print("Invalid command! Try again.")   def outskirts():     global player_gold     global player_health     print("\n")     print("You are in the outskirts.")     while True:         action = input("> ")         if action == "1":             village()         elif action == "2":             river()         elif action == "3":             farmlands()         elif action == "4":             forest()         elif action == "h":             print("Health:",player_health)         elif action == "i":             print("Inventory:")             for items in player_inventory:                 print(items)         elif action == "g":             print("Gold:",player_gold)         elif action == "m":             print("Map: the village(1), the river(2), the farmlands(3), the forest(4).")         elif action == "e":             print("You can see the boy fishing from across the river.")             if "Sword" not in player_inventory:                 print("You see a shiny item lying in the grass.")                 print("Will you take it? Yes(y) or no(n)?")                 action = input("> ")                 if action == "n":                     print("Some things are better left where you found them.")                 elif action == "y":                     print("You reach for it. It's a beautiful and sharp sword!")                     print("But as soon as you grab it, a snake bites your hand!")                     snake_attack = random.randint(1,100)                     player_health -= snake_attack                     player_inventory.append("Sword")                 else:                     print("Invalid command! Try again.")                     action = input("> ")                     if action == "n":                         print("Some things are better left where you found them.")                     elif action == "y":                         print("You reach for it. It's a beautiful and sharp sword!")                         print("But as soon as you grab it, a snake bites your hand!")                         snake_attack = random.randint(1,100)                         player_health -= snake_attack                         player_inventory.append("Sword")         elif action == "t":             print("You yell to the boy across the river.")             print("'Hey! How did you get over there?'")          else:             print("Invalid command! Try again.")   def shop():     global player_gold     global player_health     print("\n")     print("You are in the shop.")     while True:         action = input("> ")         if action == "1":             village()         elif action == "2":             river()         elif action == "3":             farmlands()         elif action == "4":             forest()         elif action == "h":             print("Health:",player_health)         elif action == "i":             print("Inventory:")             for items in player_inventory:                 print(items)         elif action == "g":             print("Gold:",player_gold)         elif action == "m":             print("Map: the village(1), the river(2), the farmlands(3), the forest(4).")         elif action == "e":             print("A friendly woman is standing at the counter.")             print("'Hello! Can I help you, young man?'")         elif action == "t":             print("'Please, browse our wares.'")             print("'We have what you need.'")             print("'Do you want to see what we have?'")             print("Yes(y) or no(n)?")             action = input("> ")             if action == "y":                 print("You can buy:")                 print("a fishing pole(f) for 10 gold, a leather tunic(t) for 20 gold,")                 print("a guitar(g) for 30 gold, and a raft(r) for 15 gold.")                 action = input("> ")                 if action == "f":                       if "Fishing poll" in player_inventory:                           print("I aleady have one!")                       elif player_gold >= 10:                           player_inventory.append("Fishing poll")                           player_gold -= 10                           print("'Here you go!'")                           print("You bought a lovely handmade fishing poll.")                       elif player_gold < 5:                           print("Sorry you don't have enough for this, kid.")                 elif action == "t":                       if "Tunic" in player_inventory:                           print("I aleady have one!")                       elif player_gold >= 20:                           player_inventory.append("Leather tunic")                           player_gold -= 20                           print("'Here you go!'")                           print("You bought a bulky leather tunic.")                       elif player_gold < 20:                           print("Sorry you don't have enough for this, kid.")                 elif action == "g":                       if "Guitar" in player_inventory:                           print("I aleady have one!")                       elif player_gold >= 30:                           player_inventory.append("Guitar")                           player_gold -= 30                           print("'Here you go!'")                           print("You bought a gorgeous guitar.")                       elif player_gold < 30:                           print("Sorry you don't have enough for this, kid.")                 elif action == "r":                       if "Raft" in player_inventory:                           print("I aleady have one!")                       elif player_gold >= 15:                           player_inventory.append("Raft")                           player_gold -= 15                           print("'Here you go!'")                           print("You bought a small wooden raft.")                       elif player_gold < 15:                           print("Sorry you don't have enough for this, kid.")                 else:                       print("Invalid command! Try again.")              elif action == "n":                 print("'Okay, no worries! I just love your company.'")                 print("'Tell your friends about this place, okay?'")              else:                 print("Invalid command! Try again.")                 print("'Please, browse our wares.'")                 print("'We have what you need.'")                 print("'Do you want to see what we have?'")                 print("Yes(y) or no(n)?")                 action = input("> ")          else:             print("Invalid command! Try again.")   def forest_two():     global player_gold     global player_health     print("\n")     print("You are deep into the forest.")     while True:         action = input("> ")         if action == "1":             print("I don't know how to get there. I'm lost.")         elif action == "2":             print("I don't know how to get there. I'm lost.")         elif action == "3":             print("I don't know how to get there. I'm lost.")         elif action == "4":             print("I don't know how to get there. I'm lost.")         elif action == "h":             print("Health:",player_health)         elif action == "i":             print("Inventory:")             for items in player_inventory:                 print(items)         elif action == "g":             print("Gold:",player_gold)         elif action == "m":             print("Map: the village(1), the river(2), the farmlands(3), the forest entrance(4)")         elif action == "e":             print("You are in a part of the forest you've never seen before.")             print("You are lost...")         elif action == "t":             print("You call for help.")             print("You suddenly hear the girl scream again.")             print("This time louder...")             print("Will you investigate?")             print("Yes(y) or no(n)?")             action = input("> ")             if action == "n":                 print("You decide not to go.")                 print("A wolf howls in the distance.")                 print("The moon glistening above you.")             elif action == "y":                 final()             else:                 print("Invalid command! Try again.")          else:             print("Invalid command! Try again.")   def final():     global player_gold     global player_health     print("\n")     print("You are even further into the woods.")     print("You see an old, abandoned cabin just ahead.")     while True:         action = input("> ")         if action == "1":             print("I can't go there. I'm lost!")         elif action == "2":             print("I can't go there. I'm lost!")         elif action == "3":             print("I can't go there. I'm lost!")         elif action == "4":             print("I can't go there. I'm lost!")         elif action == "h":             print("Health:",player_health)         elif action == "i":             print("Inventory:")             for items in player_inventory:                 print(items)         elif action == "g":             print("Gold:",player_gold)         elif action == "m":             print("Map: the village(1), the river(2), the farmlands(3), the forest entrance(4).")         elif action == "e":             print("The screaming is now even closer...")             print("You are frozen with terror.")         elif action == "t":             print("You call for the girl.")             print("She can hear you now!")             print("'Help me! Please, help me!'")             print("Her voice sounds like it's coming from the cabin.")             print("Will you go?")             print("Yes(y) or no(n)?")             action = input("> ")             if action == "n":                 print("You hide behind some trees.")                 print("You look behind you into the forest.")                 print("There's no turning back.")             elif action == "y":                 cabin()             else:                 print("Invalid command! Try again.")          else:             print("Invalid command! Try again.")   def cabin():     global player_gold     global player_health     print("\n")     print("You are right outside of the cabin.")     print("You draw your sword...")     while True:         action = input("> ")         if action == "1":             print("No turning back.")         elif action == "2":             print("No turning back.")         elif action == "3":             print("No turning back.")         elif action == "4":             print("No turning back.")         elif action == "h":             print("Health:",player_health)         elif action == "i":             print("Inventory:")             for items in player_inventory:                 print(items)         elif action == "g":             print("Gold:",player_gold)         elif action == "m":             print("Map: the village(1), the river(2), the farmlands(3), the forest entrance(4).")         elif action == "e":             print("You walk up to the door and raise your sword.")             print("Will you enter? Yes(y) or no(n)?")             action = input("> ")             if action == "n":                 print("You wait to regain your composure.")                 print("You muster up a little courage.")                 print("Something terrible is waiting behind the door.")             elif action == "y":                 print("\n")                 print("You open the door. It creaks loudly as peak inside.")                 print("You see a small girl with red hair lying in the corner.")                 print("'Help me! Someone brought me here and he's going to kill me!'")                 print("She sobs hopelessly.")                 print("You ask her where he is.")                 print("'I don't know.' She says. 'He left a few minutes ago to get an axe!'")                 print("'Please help me! My name is Ruby. My dad is looking for me!'")                 time.sleep(10)                 print("\n")                 print("A man in a black robe bursts into the cabin with a bloody axe!")                 time.sleep(5)                 print("\n")                 print("Ruby screams.")                 print("'No! Please. I didn't do anything...'")                 print("'Help me, boy!'")                 time.sleep(5)                 print("\n")                 print("The man raises his axe to slice you apart.")                 print("But you swiftly parry his attack with your sword.")                 time.sleep(5)                 print("\n")                 print("You raise your sword to strike back.")                 print("Ruby puts her hands over her face.")                 time.sleep(5)                 print("\n")                 print("You slice into the man's shoulder.")                 time.sleep(5)                 print("\n")                 print("He strikes again...")                 enemy_attack = random.randint(1,100)                 player_health -= enemy_attack                 print("He swings his axe furiously toward you...")                 time.sleep(5)                 print("\n")                 print("He cuts into your arm as you moan in agony!")                 print("Ruby screams.")                 time.sleep(5)                 print("\n")                 print("You fall on the floor and drop your sword...")                 if player_health > 0:                     time.sleep(5)                     print("\n")                     print("In a last burst of strength,")                     print("You lift up the sword with both hands")                     print("and charge toward the shadowy figure.")                     time.sleep(5)                     print("\n")                     print("You cut into the man's chest and pierce his heart.")                     time.sleep(5)                     print("\n")                     print("He falls to the floor.")                     print("He lies in a puddle of his own blood.")                     time.sleep(5)                     print("\n")                     print("Ruby runs toward you, crying.")                     print("'You saved my life!' She exclaims enthusiastically.")                     print("You drop your sword, exausted")                     time.sleep(5)                     print("\n")                     print("She embraces you, tightly.")                     print("'Please take me home to my daddy's farm...' She begs.")                     time.sleep(5)                     print("\n")                     print("You both return to the farm.")                     print("The farmer sees you and his daughter walking toward the farm.")                     print("'Ruby! You're back!'")                     time.sleep(5)                     print("\n")                     print("'You were the boy I saw yesterday!'")                     print("You shrug in agreement.")                     time.sleep(5)                     print("\n")                     print("'You found my daughter, boy!' He says excitedly.")                     print("'I can't thank you enough.'")                     print("Ruby runs home to her father.")                     print("She looks back at you and smiles.")                     time.sleep(5)                     print("\n")                     print("You return home.")                     print("Your mother must be worried sick!")               elif player_health <= 0:                 print("You fall unconscious as the hooded figure drags you away...")                 sys.exit              else:                 print("Invalid command! Try again.")          elif action == "t":             print("You anxiously hyperventilate. You cannot make a sound.")           else:             print("Invalid command! Try again.")   menu() 

I cant make request rest API using a header APIkey in python (requests library)(Im beginner)

i am a begginer at programming. I am recieving an error message: b'{“message”:”Missing Authentication Token”}’ every time I try to get a request with the line. There is no basic authentication needed i think, the only authentication that is given is a apikey and that needs to be passed in a header called x-api-key.

headers = x-api-key:'123EXAMPLEMYKEY12312123123'     r = requests.get('http://www.thecompany.com/', headers=headers) 

the r.status_code is 403

I am beginner and need help with Super Blade Pro & Plastic Wrap filters

Hi to all,

I have joined only a few minutes ago. I was using Paint Shop Pro in the past but have decided to move on to Photoshop. Not sure why, but I do struggle quite a lot in Photoshop.

I really hope someone will be so kind to help me … I have just joined the forum but I have already problems, i.e. filters.

Super Blade Pro (an older version) do not appear under Filters after install. I have tried to download the latest version which is a trial at Flaming Pear site but that file…

I am beginner and need help with Super Blade Pro & Plastic Wrap filters

Python snake game – beginner

I am a complete beginner when it comes to programming and writing games and this is my first ever game. I made it with python 3 using pygame library. I would appreciate any feedback really.

from __future__ import annotations from typing import Tuple, List import pygame import random import sys   # screen width & height and block size bg_width = 500 bg_height = 500 block_size = 10  # direction strings left = "LEFT" right = "RIGHT" up = "UP" down = "DOWN"  # colors (RGB) bg_color = black = (0, 0, 0) yellow = (255, 255, 0) green = (0, 128, 0) red = (255, 0, 0) blue = (0, 0, 255)  # pygame & font initialization pygame.init() window = pygame.display.set_mode((bg_width, bg_height)) pygame.display.set_caption("Snake") font = pygame.font.SysFont('Times New Roman', 20) text_colour = pygame.Color('White') fps = pygame.time.Clock()   class Snake:     """This class represents a snake object. Every snake object consists of a head         and its body.         ===Attributes===         head: snake head         color: snake color         body: snake body         direction: direction of head         size: size of snake (head and body)         """     head: List[int, int]     color: Tuple[int, int, int]     body: List[List[int, int]]     direction: str     size: int      def __init__(self, color: Tuple[int, int, int]) -> None:         self.head = [int(10*block_size), int(5*block_size)]         self.color = color         self.body = [self.head, [9*block_size, 5*block_size]]         self.direction = right         self.size = 2      def change_dir(self, direc: str) -> None:         if self.direction != left and direc == right:             self.direction = right         elif self.direction != right and direc == left:             self.direction = left         elif self.direction != down and direc == up:             self.direction = up         elif self.direction != up and direc == down:             self.direction = down      def move(self) -> None:         if self.direction == right:             self.head[0] += block_size         elif self.direction == left:             self.head[0] -= block_size         elif self.direction == up:             self.head[1] -= block_size         elif self.direction == down:             self.head[1] += block_size         self.body.insert(0, list(self.head))         self.body.pop()         if self.body[0] != self.head:             self.head = self.body[0]      def add_to_tail(self) -> None:         new_part = [self.body[-1][0], self.body[-1][1]]         self.body.append(new_part)         self.size += 1      def get_body(self) -> List[List[int, int]]:         return self.body   class Food:     """This class represents a food object. Each food object has an x        and a y value, a color and a state.        ===Attributes===        x: x-coordinate of food object        y: y-coordinate of food object        color: color of food object        state: whether food object is on screen or not        position: x,y-coordinates pair of food object        """     x: int     y: int     color: Tuple[int, int, int]     state: bool     position: Tuple[int, int]      def __init__(self, color: Tuple[int, int, int]) -> None:         self.x = random.randint(0, bg_width//block_size - 1)*block_size         self.y = random.randint(0, bg_height//block_size - 1)*block_size         self.color = color         self.state = True         self.position = self.x, self.y      def spawn(self) -> Tuple[int, int]:         if self.state:             return self.x, self.y         else:             self.state = True             self.x = random.randint(0, bg_width // block_size-1) * block_size             self.y = random.randint(0, bg_height // block_size-1) * block_size             return self.x, self.y      def update(self, state) -> None:         self.state = state   def collision(snake_: Snake, food_target_x: int, food_target_y: int) -> int:     snake_rect = pygame.Rect(*snake_.head, block_size, block_size)     food_rect = pygame.Rect(food_target_x, food_target_y, block_size,                             block_size)     if snake_rect == food_rect:         snake_.add_to_tail()         return 1     return 0   def wall_collision(s: Snake) -> bool:     if (s.head[0] < 0) or (s.head[0] > bg_width-block_size) or (s.head[1] < 0)\             or (s.head[1] > bg_height-block_size):         return True     return False   def game():      # initialize food and snake     food = Food(blue)     snake = Snake(green)      # initialize loop logic     running = True     is_over = False      # initialize score     score = 0      # game loop     while running:          # Game over Screen         while is_over:             text_on_screen = font.render("You scored: " + str(score) +                                          ", Press R to play again or Q to quit",                                          True, text_colour)             window.blit(text_on_screen, [55, 225])             for event in pygame.event.get():                 pressed_key = pygame.key.get_pressed()                 if event.type == pygame.QUIT:                     pygame.quit()                     sys.exit()                 if pressed_key[pygame.K_q]:                     pygame.quit()                     sys.exit()                 if pressed_key[pygame.K_r]:                     game()             pygame.display.update()          # check events         for event in pygame.event.get():             if event.type == pygame.QUIT:                 pygame.quit()                 sys.exit()             pressed = pygame.key.get_pressed()             if pressed[pygame.K_RIGHT] or pressed[pygame.K_d]:                 snake.change_dir(right)             elif pressed[pygame.K_LEFT] or pressed[pygame.K_a]:                 snake.change_dir(left)             elif pressed[pygame.K_UP] or pressed[pygame.K_w]:                 snake.change_dir(up)             elif pressed[pygame.K_DOWN] or pressed[pygame.K_s]:                 snake.change_dir(down)          # fill window and draw snake         window.fill(black)         for item in snake.get_body():             pygame.draw.rect(window, snake.color, [item[0], item[1], block_size,                                                    block_size])          # move snake         snake.move()          # check for collision with wall:         collision_with_wall = wall_collision(snake)         if collision_with_wall:             is_over = True          # check if food is still on screen and draw it         food_pos = food.spawn()         collision_ = collision(snake, *food_pos)         if collision_ == 1:             score += 1             food.update(False)         pygame.draw.rect(window, food.color, [food_pos[0], food_pos[1],                                               block_size, block_size])          # renders display         pygame.display.flip()          # time delay         pygame.time.delay(60)         fps.tick(30)      pygame.quit()     quit()   game() ``` 

Beginner programmer having problems with first program assignment

I have made a few adjustments, I still can not seem to find the problem. any help would be appreciated.

          1 ##         2 # This program computes the price of an order            from           3 # the total price and the number of the books            that          4 # were ordered from the bookstore.         5 # Constant tax rate of 7.5% on the total price            of          6 # each book.         7         8 TAX_RATE = 0.075         9         10 # Obtain number of books and book price from            order.         11 userInput = input(Number of Books purchased            ?")         12 numBooks = float(userInput)         13         14 userInput = input("Total Book Costs ?")         15 bookPrice = float(userInput)         16         17 # Calculate total for books.         18 totalForBooks = numBooks * bookPrice         19         20 totalTax = numBooks * TAX_RATE         21         22 shippingCostPerBook = 2         23 totalShippingCost = shippingCostPerBook *            numBooks         24         25 # Calculate the total of their order            including price         26 # of book(s), tax, and shipping costs.         27         28 totalOfOrder = totalForBooks + totalTax +            totalShippingCost         29 print("tax : %2f" % totalTax)         30 print("Total Shipping :" % totalShippingCost)           x 31 print("Total Order : %.2f % totalOfOrder)  

I have tried to add parenthesis, (str). I continue to get an X error in line 31. again, help would be appreciated.

I am beginner in Laravel, I am stuck into this error from the last two days. How will I solve this error. and where I will find the Grant_type code

{ “error”: “unsupported_grant_type”, “error_description”: “The authorization grant type is not supported by the authorization server.”, “hint”: “Check that all required parameters have been provided”, “message”: “The authorization grant type is not supported by the authorization server.” }