This file contains 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 BasketballPlayer: | |
def __init__(self, first_name, last_name, height_cm, weight_kg): | |
self.first_name = first_name | |
self.last_name = last_name | |
self.height_cm = height_cm | |
self.weight_kg = weight_kg | |
with open("player_database.txt", "w") as database: | |
database.write(str(self.__dict__)) |
This file contains 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
{"Albania":"Tirana", | |
"Andorra":"Andorra la Vella", | |
"Armenia":"Yerevan", | |
"Austria":"Vienna", | |
"Azerbaijan":"Baku", | |
"Belarus":"Minsk", | |
"Belgium":"Brussels", | |
"Bosnia and Herzegovina":"Sarajevo", | |
"Bulgaria":"Sofia", | |
"Croatia":"Zagreb", |
This file contains 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
{"Albania":"Tirana", | |
"Andorra":"Andorra la Vella", | |
"Armenia":"Yerevan", | |
"Austria":"Vienna", | |
"Azerbaijan":"Baku", | |
"Belarus":"Minsk", | |
"Belgium":"Brussels", | |
"Bosnia and Herzegovina":"Sarajevo", | |
"Bulgaria":"Sofia", | |
"Croatia":"Zagreb", |
This file contains 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 | |
import json | |
import datetime | |
def play_game(level): | |
secret = random.randint(1, 30) | |
attempts = 0 | |
wrong_guesses = [] | |
players_name = str(input("What is your name? Type here:")) |
This file contains 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
all_hair_colors = {"black_hair": "CCAGCAATCGC", "brown_hair": "GCCAGTGCCG", "blonde_hair": "TTAGCTATCGC"} | |
all_face_shapes = {"square_face": "GCCACGG", "round_face": "ACCACAA", "oval_face": "AGGCCTCA"} | |
all_eye_colors = {"blue_eyes": "TTGTGGTGGC", "green_eyes": "GGGAGGTGGC", "brown_eyes": "AAGTAGTGAC"} | |
all_genders = {"female": "TGAAGGACCTTC", "male": "TGCAGGAACTTC"} | |
all_races = {"white": "AAAACCTCA", "black": "CGACTACAG", "asian": "CGCGGGCCG"} | |
eva = {"name": "Eva", "gender": "female", "race": "white", "hair_color": "blonde_hair", "eye_color": "blue_eyes", | |
"face_shape": "oval_face"} | |
larisa = {"name": "Larisa", "gender": "female", "race": "white", "hair_color": "brown_hair", "eye_color": "brown_eyes", | |
"face_shape": "oval_face"} |
This file contains 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
do_convert = "yes" | |
print("Welcome to the km to mi converter!") | |
while do_convert == "yes": | |
kilometers = int(input("How many kilometers do you want to convert to miles? ")) | |
miles = kilometers * 0.621371 | |
print (str(kilometers) + " km is " + str(miles) + " mi!") | |
do_convert = input("Would you like to make another conversion? Enter yes or no here: ") |
This file contains 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
mood = input("How are you feeling? I don't have that much emotional inteligence, so your options are: happy, sad, excited, relaxed and nervous! Enter one here! ") | |
if mood == "happy": | |
print("It is great to see you happy!") | |
elif mood == "sad": | |
print("Watch an episode of Friends, it'll help.") | |
elif mood == "excited": | |
print("I'm excited you're excited!.") | |
elif mood == "relaxed": | |
print("Chill with your friends!") |