📖
Advanced Python
  • AdvancedPython.net
  • Day 1
    • Introduction
    • Activity 1
  • Day 2
    • Introduction
    • Activity 2
  • Day 3
    • Introduction
    • Activity 3
  • Day 4
    • Introduction
    • Activity 4
  • Day 5
    • Introduction
    • Activity 5
  • Day 6
    • Introduction
    • Activity 6
  • Day 7
    • Introduction
    • Activity 7
  • Day 8
    • Introduction
    • Activity 8
  • Day 9
    • Introduction
    • Final Project
  • Day 10
    • Introduction
Powered by GitBook
On this page
  • Presentation
  • Presentation Video
  • Starter Code - index.html
  • Starter Code - application.py
  • Starter Code - friends.html
  • Starter Code - outline.html

Was this helpful?

  1. Day 8

Activity 8

PreviousIntroductionNextIntroduction

Last updated 4 years ago

Was this helpful?

Presentation

Presentation Video

Starter Code - index.html

<!DOCTYPE html>
<html>
    <head>
        <title>Welcome to Activity 8</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    </head>
    <body>
        Welcome to Activity 8!
        <P>
        <h1>Friends Part A</h1>
        <li><a href="/friends/sam">Sam</a>
        <li><a href="/friends/alex">Alex</a>
        <li><a href="/friends/jordan">Jordan</a>
        <P>
        <h1>Part B</h1>
        <li><a href="/outline">Outline</a>
    </body>
</html>

Starter Code - application.py

from flask import Flask, render_template
app = Flask(__name__)

@app.route("/")
def index():
    return render_template('index.html')

@app.route("/friends")
@app.route("/friends/<name>")
def friends(name=None):
    return render_template('friends.html',name=name)
    
@app.route("/outline")
def outline():
    return render_template('outline.html')

Starter Code - friends.html

<!DOCTYPE html>
<html>
    <head>
        <title>{{name}}</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    </head>
    <body>
        <h1>{{name}}</h1>
    </body>
</html>

Starter Code - outline.html

<!DOCTYPE html>
<html>
  <head>
    <title>Outline of your story</title>
  </head>
  <body>
  <h1>Outline of your story</h2>
  Here we are going to use nested lists (lists within lists) to organize your story.
  <ul>
    <li>Start at your house</li>
    <li>Goto school
      <ul>
        <li>Enter Classroom 1</li>
        <li>Enter Classroom 2</li>
      </ul>
    <li>Stay virtual
      <ul>
        <li>Enter Virtual Classroom 1</li>
        <li>Enter Virtual Classroom 2</li>
      </ul>
    </li>
  </ul>

  </body>
</html>