Volume 2 Introduction
Use CodeCraft to learn Python Basics
Contents:
6 - 7 - More about String? 8 - List 9 - User Input 10 - Conditionals-- Boolean and if/else statements 11 - While Loop 12 - Dictionary 13 - Module, randint()
Some examples in volume 2:
List Looping through a list, show the list in CodeCraft,(white columns)
list methods, such as reverse a list: purple columns mirror the white original list
sort a list: the pink columns reorder the list in ascending order.
list functions, such as find out the maxieum and minium value of a number list, highlighted with red and green
Dictionary
Add new key:value pair to materials
dictionary, define air
block:
{'brick': 1, 'cobblestone': 2,.... 'wool_yellow': 76, 'air': 0}
Define function dig(x,y,z)
, and dig a few holes in the middle of a wall
Module,
for
loop and randint()
work together to generate blocks of random materials at random locations; and some random colored columns of random heights(1-20)