Go to this website: https://repl.it/languages/python3
Before we start, let's learn about an easier way to put variables inside text strings (this only works in Python 3 and won't work in Trinket).
If we type:
x = 'y'
print(f"Hello {x}!")
What is the output?
What happens if we take away the f?
Can you remember how to change the code so it produces this output?
What is your name?Superman
Hello Superman!
Python Pokemon Game
Try to code a simple Pokemon game like the example below using for loops:
A wild Mewtwo appears!
Do you want to fight or run away?
The Mewtwo attacks you!
Go! Bulbasaur!
Mewtwo has defeated Bulbasaur!
Press enter to send out your next Pokemon
Go! Squirtle!
Mewtwo has defeated Squirtle!
Press enter to send out your next Pokemon
Go! Charmander!
Mewtwo has defeated Charmander!
Press enter to send out your next Pokemon
Go! Pikachu!
Mewtwo has defeated Pikachu!
Press enter to send out your next Pokemon
You have no more Pokemon.
You have been defeated!
-------------------------------
Level 2
Did you finish the project?
If you finished, try the next two challenges.
1) Add an if clause to allow for the player to run away. Create alternative text for this scenario. Your text might look something like this:
A wild Mewtwo appears!
Do you want to fight(f) or run away(r)?r
You are very boring.
THE END
2) Give Mewtwo a set number of HP and allow the players to characters to do semi random levels damage to Mewtwo with each round. Your final code might look something like this:
A wild Mewtwo appears!
Do you want to fight(f) or run away(r)?f
The Mewtwo attacks you!
Mewtwo has 5000 hp.
Go! Bulbasaur!
Bulbasaur attacks Mewtwo!
Bulbasaur does 79 damage to Mewtwo.
Mewtwo has 4921 hp.
Mewtwo attacks Bulbasaur
Mewtwo has defeated Bulbasaur!
Press enter to send out your next Pokemon
Go! Squirtle!
Squirtle attacks Mewtwo!
Squirtle does 74 damage to Mewtwo.
Mewtwo has 4847 hp.
Mewtwo attacks Squirtle
Mewtwo has defeated Squirtle!
Press enter to send out your next Pokemon
Go! Charmander!
Charmander attacks Mewtwo!
Charmander does 36 damage to Mewtwo.
Mewtwo has 4811 hp.
Mewtwo attacks Charmander
Mewtwo has defeated Charmander!
Press enter to send out your next Pokemon
Go! Pikachu!
Pikachu attacks Mewtwo!
Pikachu does 80 damage to Mewtwo.
Mewtwo has 4731 hp.
Mewtwo attacks Pikachu
Mewtwo has defeated Pikachu!
Press enter to send out your next Pokemon
You have no more Pokemon.
You have been defeated!