Write a Python program to find out how many building blocks a player has left in Minecraft after giving some out.
Ask for the player’s name and store it in a variable called name
.
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).
Add all these blocks together to find the total number of building blocks.
Store this total in a variable called total_blocks
.
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).
Subtract gave_out_blocks
from total_blocks
and store the result in a variable called blocks_left
.
Print a message like:
“Hi [name]! After giving out some blocks, you have [blocks_left] blocks left in your Minecraft inventory.”
We’re always looking for international STEM educators to join our team. If you are interested, please send us a mail and we’ll get back to you!
If you have any questions, kindly send us a mail. Don’t forget to follow and like all our social accounts to get updates on competitions!