Question 24: Minecraft

⛏️ Python Program – Minecraft Inventory 

Write a Python program to find out how many building blocks a player has left in Minecraft after giving some out.

  1. Ask for the player’s name and store it in a variable called name.

  2. Ask how many cobblestone blocks they mined, how many oak logs they collected, and how many iron blocks they crafted.

    • Store these in variables: cobblestone, oak_logs, and iron_blocks (as integers).

  3. Add all these blocks together to find the total number of building blocks.

    • Store this total in a variable called total_blocks.

  4. Ask how many blocks they gave out to friends to help build a house.

    • Store this in a variable called gave_out_blocks (as an integer).

  5. Subtract gave_out_blocks from total_blocks and store the result in a variable called blocks_left.

  6. Print a message like:

“Hi [name]! After giving out some blocks, you have [blocks_left] blocks left in your Minecraft inventory.”

 

Write what you are looking for, and press enter to begin your search!