sudo apt-get install python3-pip
sudo pip3 install virtualenv
| def process_placement(self, player): | |
| for current_ship in player.ships: | |
| player.current_ship_name = current_ship[0] | |
| player.current_ship_length = current_ship[1] | |
| player.current_ship = current_ship | |
| while True: | |
| # Placement_point is the input from the player (a2, d3, etc) | |
| placement_point = self.ask_for_placement( | |
| player.name, | |
| player.current_ship_name, |
| /* | |
| * Programming Quiz: Build A Triangle (5-3) | |
| */ | |
| // creates a line of * for a given length | |
| function makeLine(length) { | |
| var line = ""; | |
| for (var j = 1; j <= length; j++) { | |
| line += "* "; | |
| } |
| /* | |
| ##Device = Desktops | |
| ##Screen = 1281px to higher resolution desktops | |
| */ | |
| @media (min-width: 1281px) { | |
| //CSS | |
| * { background-color: rgba(255,0,0,.2); } | |
| * * { background-color: rgba(0,255,0,.2); } | |
| * * * { background-color: rgba(0,0,255,.2); } | |
| * * * * { background-color: rgba(255,0,255,.2); } | |
| * * * * * { background-color: rgba(0,255,255,.2); } | |
| * * * * * * { background-color: rgba(255,255,0,.2); } | |
| * * * * * * * { background-color: rgba(255,0,0,.2); } | |
| * * * * * * * * { background-color: rgba(0,255,0,.2); } | |
| * * * * * * * * * { background-color: rgba(0,0,255,.2); } |
| /* | |
| What are the top 10 most rented travel films in 2005 of over two hours duration? | |
| */ | |
| SELECT DISTINCT subquery.film_id, subquery.title, | |
| subquery.category, | |
| COUNT(subquery.title) OVER(PARTITION BY subquery.title) AS rental_count | |
| FROM ( | |
| SELECT film.film_id film_id, film.title title, | |
| category.name category, |
| /* | |
| Who are the top 5 active customers who have spent most in renting films? | |
| */ | |
| SELECT DISTINCT customer.customer_id, CONCAT(first_name, ' ', last_name) AS customer, | |
| SUM(payment.amount) OVER(PARTITION BY customer) AS total_amt_spent | |
| FROM customer | |
| JOIN payment | |
| ON customer.customer_id = payment.customer_id | |
| WHERE customer.active = 1 |
| /* | |
| What are the top 10 film categories where most money have been received? | |
| */ | |
| SELECT DISTINCT category.category_id, | |
| category.name category, | |
| COUNT(category) OVER(PARTITION BY category) AS rental_count, | |
| ROUND(AVG(payment.amount) OVER(PARTITION BY category), 2) AS avg_amt_received, | |
| SUM(payment.amount) OVER(PARTITION BY category) AS total_amt_received | |
| FROM film |
| /* | |
| How much money each staff has processed to date? | |
| */ | |
| SELECT DISTINCT subquery.staff_id, subquery.staff, | |
| SUM(subquery.payment_amount) OVER(PARTITION BY subquery.staff) AS total_amt_received | |
| FROM ( | |
| SELECT staff.staff_id staff_id, | |
| CONCAT(staff.first_name, ' ', staff.last_name) AS staff, | |
| payment.amount payment_amount, payment.payment_date payment_date |
| # coding: utf-8 | |
| from weasyprint import HTML, CSS | |
| def get_page_body(boxes): | |
| for box in boxes: | |
| if box.element_tag == 'body': | |
| return box |