This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Wheel: | |
| #Have a model name | |
| #Have a weight | |
| #Have a cost to produce | |
| #There should be a total of three different wheel types | |
| def __init__(self,name,weight,cost): | |
| self.name = name | |
| self.weight = weight | |
| self.cost = cost |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def rgb_hex(): | |
| invalid_msg = "Something went wrong. Check your response." | |
| red = int(raw_input("What is the RED value? ")) | |
| if ((red < 0) or (red > 255)): | |
| print invalid_msg | |
| return | |
| green = int(raw_input("What is the GREEN value? ")) | |
| if ((green < 0) or (green > 255)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Bassist(object): | |
| def __init__(self): | |
| self.sounds = ["Twang", "Thrumb", "Bling"] | |
| def solo(self, length): | |
| for i in range(length): | |
| print(self.sounds[i % len(self.sounds)], end=" ") | |
| print() | |
| class Guitarist(object): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| questions = { | |
| "strong": "Do ye like yer drinks strong? ", | |
| "salty": "Do ye like it with a salty tang? ", | |
| "bitter": "Are ye a lubber who likes it bitter? ", | |
| "sweet": "Would ye like a bit of sweetness with yer poison? ", | |
| "fruity": "Are ye one for a fruity finish? " | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fizzbuzz(a): | |
| """performs fizzbuzz process using a for loop""" | |
| for n in range (1,a+1): | |
| if n % 3 == 0 and n % 5 == 0: | |
| print("FizzBuzz") | |
| elif n % 3 == 0: | |
| print ("Fizz") | |
| elif n % 5 == 0: | |
| print ("Buzz") | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| if len(sys.argv)< 2: | |
| maxn = int(input("Enter the max: ")) | |
| else: | |
| upper = int(sys.argv[1]) | |
| n = 0 | |
| while n <= maxn: | |
| if n % 5 == 0 and n % 3 == 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| n = 0 | |
| while (n < 101): | |
| if (n % 5 == 0) and (n % 3 == 0): | |
| print ('fizzbuzz') | |
| elif n % 5 == 0: | |
| print ('fizz') | |
| elif n % 3 == 0: | |
| print ('buzz') | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for n in range(1,101): | |
| if n % 3 == 0 and n % 5 == 0: | |
| print ("fizzbuzz") | |
| elif n % 3 == 0: | |
| print ("fizz") | |
| elif n % 5 == 0: | |
| print ("buzz") | |
| else: | |
| print (n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fblist = [] | |
| for n in range (1,101): | |
| if n % 3 == 0 and n % 5 == 0: | |
| fblist.append("fizzbuzz") | |
| elif n % 3 == 0: | |
| fblist.append("fizz") | |
| elif n % 5 == 0: | |
| fblist.append("buzz") | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| api_url='https://www.kickstarter.com/projects/597507018/pebble-2-time-2-and-core-an-entirely-new-3g-ultra/stats.json' | |
| while sleep 1; do | |
| ks_json=$(curl $api_url -s) | |
| [ $? -ne 0 ] && continue | |
| old_total=$total | |
| total=$(echo $ks_json | jq -r '.project.pledged') | |
| [[ "$total" == "$old_total" ]] && continue |
NewerOlder