Ting Lee (tlee0058)

tlee0058

Geek Repo

0

following

0

stars

Location:Washington DC

Github PK Tool:Github PK Tool

Ting Lee's repositories

flask_great_number

Assignment: Great Number Game Create a site that when a user loads it creates a random number between 1-100 and stores the number in session. Allow the user to guess at the number and tell them when they are too high or too low. If they guess the correct number tell them and offer to play again. In order to generate a random number you can use the "random" python module: import random # import the random module # The random module has many useful functions. This is one that gives a random number in a range random.randrange(0, 101) # random number between 0-100 In order to remove something from the session, you must "pop" it off of the session dictionary. # Set session like so: session['someKey'] = 50 # Remove something from session like so: session.pop('someKey') <div id="copy-toolbar-container" style="cursor: pointer; position: absolute; top: 294.818px; right: 35px; padding: 0px 3

Language:HTMLStargazers:1Issues:0Issues:0
Stargazers:0Issues:0Issues:0
Language:PythonStargazers:0Issues:0Issues:0
Stargazers:0Issues:0Issues:0

dojo_survey_validation

Assignment: Dojo Survey With Validation Take the Dojo Survey assignment that you completed previously and add validations! The Name and Comment fields should be validated so that they are not blank. Also, validate that the comment field is no longer than 120 characters.

Language:PythonStargazers:0Issues:0Issues:0

flask_counter

Assignment: Counter Build a flask application that counts the number of times the root route ('/') has been viewed. This assignment is to test your understanding of session. Ninja Level 1 Add a +2 button underneath the counter that reloads the page and increments counter by 2. Add another route to handle this functionality. Ninja Level 2 Add a reset button that resets the counter back to 1. Add another route to handle this functionality.

Language:PythonStargazers:0Issues:0Issues:0

flask_disappearing_ninjas

Assignment: Disappearing Ninja Build a flask application with the below functionality. This exercise will help you practice URL routing, using views, and rendering static content. These are the routes that you need to set up: On the default page ('localhost:5000'), it should display a view that says "No ninjas here" When user visits /ninja, it should display all four Ninja Turtles (Leonardo, Michelangelo, Raphael, and Donatello) /ninja/[ninja_color], should display the corresponding Ninja Turtle (grab the color parameter out of the requested URL) If user visits /ninja/blue, it should only display the Ninja Turtle Leonardo. /ninja/orange - Ninja Turtle Michelangelo. /ninja/red - Ninja Turtle Raphael /ninja/purple - Ninja Turtle Donatello If a user tries to hack into your web app by specifying a color or string combination other than the colors (Blue, Orange, Red, and Purple), example: /ninja/black or /ninja/123, then display the image notapril.jpg You'll need to remember how to use static files for this assignment. Take a minute to refresh your memory back to the static files section if you need to :) Click here to download the image files.

Language:HTMLStargazers:0Issues:0Issues:0

flask_registration_form

Assignment: Registration Form Create a simple registration page with the following fields: email first_name last_name password confirm_password Here are the validations you must include: All fields are required and must not be blank First and Last Name cannot contain any numbers Password should be more than 8 characters Email should be a valid email Password and Password Confirmation should match When the form is submitted, make sure the user submits appropriate information. If the user did not submit appropriate information, return the error(s) above the form that asks the user to correct the information. Message Flashing with Categories For this, you will need to use flash messages at the very least. You may have to take this one step further and add categories to the flash messages. You can learn that from the flask doc: flash messages with categories If the form with all the information is submitted properly, simply have it say a message "Thanks for submitting your information." Ninja Version: Add the validation that requires a password to have at least 1 uppercase letter and 1 numeric value. Hacker Version: Add a birth-date field that must be validated as a valid date and must be from the past.

Language:HTMLStargazers:0Issues:0Issues:0
Stargazers:0Issues:0Issues:0
Stargazers:0Issues:0Issues:0

mySQL_favorite-_book

Create an ERD to represent the database for an application that tracks users, books, and user's favorite books. Each book should have a title and an author, and each user should be able to save a list of their favorite books. Use the MySQL Workbench for creating this database. For the purposes of this assignment, you may include the author's name directly into the book records, even though it would be better normalized by creating a separate author's table.

Stargazers:0Issues:0Issues:0

mySQL_flask_full_friends

Assignment: Full Friends Create an application that allows users to view all friends and add a new one: Have the main page show all users and their data as part of a table. On the same page allow users to enter data and submit that data to the database in order to add a new friend. How many routes do you need? What should each do? Think back to routing from the previous section, and remember never to render from a post route.

Language:PythonStargazers:0Issues:0Issues:0

mySQL_multi_blogs

Assignment: Blogs Create the ERD for a platform that allows users to create blogs, similar to blogspot.com. The platform must allow users to register, create multiple blogs, and even allow the user to invite other users to be co-administrators of the blog. The administrators of the blog can change the blog name, add posts, edit posts, add comments, edit comments for each post, and upload new files associated with the blog post. We also want to capture information about which page the logged in users are viewing (e.g. page visited, when they visited, how long they stayed, IP address, name, etc). Use the MySQL workbench to complete this assignment.

Stargazers:0Issues:0Issues:0

oop_animal

Assignment: Animal Create an Animal class and give it the below attributes and methods. Extend the Animal class to two child classes, Dog and Dragon. Objective The objective of this assignment is to help you understand inheritance. Remember that a class is more than just a collection of properties and methods. If you want to create a new class with attributes and methods that are already defined in another class, you can have this new class inherit from that other class (called the parent) instead of copying and pasting code from the original class. Child classes can access all the attributes and methods of a parent class AND have new attributes and methods of its own, for child instances to call. As we see with Wizard / Ninja / Samurai (that are each descended from Human), we can have numerous unique child classes that inherit from the same parent class. Animal Class Attributes: • name • health Methods: • walk: decreases health by one • run: health decreases by five • display health: print to the terminal the animal's health. Create an instance of the Animal, have it walk() three times, run() twice, and finally displayHealth() to confirm that the health attribute has changed. Dog Class • inherits everything from Animal Attributes: • default health of 150 Methods: • pet: increases health by 5 Have the Dog walk() three times, run() twice, pet() once, and have it displayHealth(). Dragon Class • inherits everything from Animal Attributes: • default health of 170 Methods: • fly: decreases health by 10 • display health: prints health by calling the parent method and prints "I am a Dragon" Now try creating a new Animal and confirm that it can not call the pet() and fly() methods, and its displayHealth() is not saying 'this is a dragon!'. Also confirm that your Dog class can not fly().

Stargazers:0Issues:0Issues:0

oop_bike

Assignment: Bike Create a new class called Bike with the following properties/attributes: price max_speed miles Create 3 instances of the Bike class. Use the __init__() function to specify the price and max_speed of each instance (e.g. bike1 = Bike(200, "25mph"); In the __init__() also write the code so that the initial miles is set to be 0 whenever a new instance is created. Add the following functions to this class: displayInfo() - have this method display the bike's price, maximum speed, and the total miles. ride() - have it display "Riding" on the screen and increase the total miles ridden by 10 reverse() - have it display "Reversing" on the screen and decrease the total miles ridden by 5... Have the first instance ride three times, reverse once and have it displayInfo(). Have the second instance ride twice, reverse twice and have it displayInfo(). Have the third instance reverse three times and displayInfo(). What would you do to prevent the instance from having negative miles? Which methods can return self in order to allow chaining methods?

Stargazers:0Issues:0Issues:0
Language:PythonStargazers:0Issues:0Issues:0

oop_car

Assignment: Car Create a class called Car. In the__init__(), allow the user to specify the following attributes: price, speed, fuel, mileage. If the price is greater than 10,000, set the tax to be 15%. Otherwise, set the tax to be 12%. Create six different instances of the class Car. In the class have a method called display_all() that returns all the information about the car as a string. In your __init__(), call this display_all() method to display information about the car once the attributes have been defined. A sample output would be like this:

Stargazers:0Issues:0Issues:0
Language:PythonStargazers:0Issues:0Issues:0
Language:PythonStargazers:0Issues:0Issues:0

oop_product

Assignment: Product The owner of a store wants a program to track products. Create a product class to fill the following requirements. Product Class: Attributes: • Price • Item Name • Weight • Brand • Status: default "for sale" Methods: • Sell: changes status to "sold" • Add tax: takes tax as a decimal amount as a parameter and returns the price of the item including sales tax • Return: takes reason for return as a parameter and changes status accordingly. If the item is being returned because it is defective, change status to "defective" and change price to 0. If it is being returned in the box, like new, mark it "for sale". If the box has been, opened, set the status to "used" and apply a 20% discount. • Display Info: show all product details. Every method that doesn't have to return something should return self so methods can be chained.

Stargazers:0Issues:0Issues:0
Language:PythonStargazers:0Issues:0Issues:0

python_basic

basic level of python assignments

Language:PythonStargazers:0Issues:0Issues:0

python_dojo_survey

Assignment: Dojo Survey Build a flask application that accepts a form submission, redirects, and presents the submitted data on a results page. The goal is to help you get familiar with sending POST requests through a form and displaying that information. Consider the below example as a guide. Hint: Although we've told you never to render from a post route, you'll need to do so for this assignment. We'll show you tools to avoid doing so soon.

Language:HTMLStargazers:0Issues:0Issues:0

python_landing_page

Assignment: Landing Page Create a flask project capable of handling the following routes. localhost:5000/ This route should serve a view file called index.html and display a greeting. This will be considered our 'root route'. localhost:5000/ninjas This route should serve a view file called ninjas.html and display information about ninjas. localhost:5000/dojos/new This route should serve a view file called dojos.html and have a form. Don't worry where the form should be sent to for now, you can simply set your action blank, like this:action=''. Next Steps Create a folder inside of your project labeled static. This static folder will be used to serve all of our static content, such as stylesheets, images, and javascript files! Now place a stylesheet in the static folder and reference it in our view files (templates).

Language:HTMLStargazers:0Issues:0Issues:0
Language:PythonStargazers:0Issues:0Issues:0
Language:PythonStargazers:0Issues:0Issues:0
Stargazers:0Issues:0Issues:0

surveys

django

Language:PythonStargazers:0Issues:0Issues:0
Language:PythonStargazers:0Issues:0Issues:0

users

django2

Language:PythonStargazers:0Issues:0Issues:0