Skip to content

Instantly share code, notes, and snippets.

View tjhartline's full-sized avatar
📈
Working from home

Tammy Hartline tjhartline

📈
Working from home
View GitHub Profile
@tjhartline
tjhartline / movement.py
Created June 8, 2022 17:12
validating multiple dict items in python
#A dictionary for the simplified dragon text game
#The dictionary links a room to other rooms.
rooms = {
'Great Hall': {'South': 'Bedroom'},
'Bedroom': {'North': 'Great Hall', 'East': 'Cellar'},
'Cellar': {'West': 'Bedroom'}
}
print('\n' * 10)
print('Your starting and current location is the Great Hall.\n')
# noinspection PyRedeclaration
@tjhartline
tjhartline / pypractice.py
Created June 8, 2022 04:23
Multiplication list in python
user_input= input()
lines = user_input.split(',')
# This line uses a construct called a list comprehension, introduced elsewhere,
# to convert the input string into a two-dimensional list.
# Ex: 1 2, 2 4 is converted to [ [1, 2], [2, 4] ]
mult_table = [[int(num) for num in line.split()] for line in lines]
for row in mult_table:
print(" | ".join([str(cell) for cell in row]))
@tjhartline
tjhartline / learning_python.py
Created June 7, 2022 19:57
Lists in Python
user_input = input()
hourly_temperature = user_input.split()
hour_temp = len(hourly_temperature)
#create an empty list
temps = []
if hour_temp >= 0:
for i in hourly_temperature: #question on i and appends i
<!DOCTYPE html>
<html>
<head>
<title>
<!--This is what will be displayed at the top of your page-->
</title>
</head>
<body>
<h1>This is a Heading</h1>
@tjhartline
tjhartline / savethedwarves.py
Created June 7, 2022 17:42
My codes and workspaces.
import pyinputplus
from pyinputplus import *
def intro():
pass
intro()
#--Room start: Snow Whites Chambers function
global user_direction, items, inventory, item
# noinspection PyRedeclaration
items = ['pie', 'crowbar', 'potion', 'uniform', 'keys', 'spellbook']