Last active
December 15, 2015 22:39
-
-
Save Battleroid/5334760 to your computer and use it in GitHub Desktop.
Trying to learn some python.
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 os | |
def hello(name): | |
print 'Hello,', name | |
os.system('pause') | |
hello('Casey') |
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 os | |
# Making list of certain size and entering values them spitting them out. | |
names = [0] * 3 | |
for index in range(len(names)): | |
names[index] = raw_input('What is your name?\n') | |
for i in names: | |
print i | |
os.system('pause') |
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 os | |
# One is a dog, the rest are cats. | |
names = ['Spooky', 'Cinder', 'Checkers', 'Elise', 'Peaches', 'Nigel'] | |
for i in names: | |
if i != 'Elise': | |
print i,'is not a dog' | |
else: | |
print i,'is a dog' | |
os.system('pause') |
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 os | |
amt = raw_input('How many items: ') | |
amt = int(amt) | |
names = []; | |
for i in range(0, amt): | |
tmp = raw_input('Item ' + str((i + 1)) + ': ') | |
names.append(tmp) | |
names.sort() | |
for item in names: | |
print(item) | |
os.system('pause') |
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 os | |
# Time | |
from time import localtime | |
stuff = {3: 'Study', 6: 'Go to class'} | |
cur_time = localtime() | |
cur_hour = cur_time.tm_hour | |
print 'It is',cur_hour | |
for i in sorted(stuff.keys()): | |
if cur_hour == i: | |
print stuff[i] | |
break | |
else: | |
print 'Nothing to do right now.' | |
os.system('pause') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment