Skip to content

macloo/python_examples

Repository files navigation

python_examples

Some files for students who have completed Learn Python the Hard Way exercises through Ex. 34.

cards_with_shuffle.py Create a deck of cards. Shuffle the deck. Draw two cards and compare their values. (See also strings.py)

dice_with_random.py Roll two dice. Keep playing as long as you do not roll 7. Score increases each time you roll.

for_loops.py Examples of for-loops in Python.

strings.py How to slice a string. Pattern --> variable [0:n]

while_loop_with_random.py A game-like example where you get weaker in a battle and lose a life. You have three lives to lose, and then the game ends.

while_loops.py Examples of while-loops in Python.

Students have just been introduced to:

  • Booleans
  • if-elif-else
  • lists
  • for loops
  • while loops

About

Files to help students do a homework assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages