HTML Code Examples

Read More
Comments Off on HTML Code Examples

List of All Tags and Attributes

Read More

Adobe Illustrator

Read More

APPENDIX

class Monster: hit_points = 1 sound = ‘roar’ … def battlecry(self): return self.sound.upper() >>> from monster import Monster >>> jubjub […]

Read More
Comments Off on APPENDIX

APPENDIX: Dicts & Tuples

# Dictionary >>> my_dict = {‘name’: ‘Kenneth’, ‘job’: ‘Teacher’} # Keys >>> my_dict[‘job’] ‘Teacher’ # Dictionaries as keys >>> name_dict […]

Read More
Comments Off on APPENDIX: Dicts & Tuples

APPENDIX: Lists

a_list.append( [4, 5] ) my_list = list( range(10) ) my_list + [10, 11, 12] our_list.extend( range(5,11) ) alpha.insert(1,’b’) new_list = […]

Read More
Comments Off on APPENDIX: Lists

Forms

We have the following Build A Character app. app.py options.py [static] |__ [css] |__ [img] [templates] |__ builder.html |__ index.html |__ […]

Read More
Comments Off on Forms

CSS, Images & JavaScript

Using stylesheets, images and scripts will improve the appearance and experience of your app greatly. Place these files inside a folder […]

Read More
Comments Off on CSS, Images & JavaScript

Template Inheritance

Instead of repeating your HTML code for each template file you can use template inheritance, where templates can inherit from each […]

Read More
Comments Off on Template Inheritance

HTML Templates

App Inline HTML As you saw, Views can print variables. But it also can print HTML code on the web […]

Read More
Comments Off on HTML Templates

Query Strings & URLs

Query Strings Sending arguments and variables to URLs is important. Users can do that using Query Strings which are the […]

Read More
Comments Off on Query Strings & URLs

First Step

Intro Flask is a great Python microframework that can make building web sites and applications much faster. It offers some […]

Read More
Comments Off on First Step

Hack-n-Slash [Game]

monster.py import random from combat import Combat COLORS = [‘yellow’, ‘red’, ‘blue’, ‘green’] class Monster(Combat): min_hit_points = 1 max_hit_points = […]

Read More
Comments Off on Hack-n-Slash [Game]

Overriding Inheritance

You can override an inherited method in a class by simply re-defining it in the subclass. #[combat.py]: import random class […]

Read More
Comments Off on Overriding Inheritance

Instance Methods

#[character.py] class Character: experience = 0 hit_points = 10 def get_weapon(self): weapon_choice = input(“Weapon ([S]word, [A]xe, [B]ow: “).lower() if weapon_choice […]

Read More
Comments Off on Instance Methods

__str__( )

It is a special method that is called whenever something is converted into a string. >>> from monster import Dragon >>> […]

Read More
Comments Off on __str__( )

Inheritance

Add New Attributes Set foreign values of corresponding keys as new attributes in the sent self instance, with the setattr( […]

Read More
Comments Off on Inheritance

Objects

Class A class is a collection of attributes and methods that can be instantiated. class Monster: hit_points = 1 color […]

Read More
Comments Off on Objects

Dungeon Game

Random Choice >>> my_list = list(range(50)) >>> my_list [0,1,2,3,4, … , 49] >>> import random >>> random.choice(my_list) 15 >>> random.choice(my_list) […]

Read More
Comments Off on Dungeon Game

Tuple Iteration

enumerate( iterable ) Printing List via for-loop >>> my_alphabet_list = list(‘abcdefghijklmnopqrstuvwxyz’) >>> count = 0 >>> for letter in my_alphabet_list: …   […]

Read More
Comments Off on Tuple Iteration