摘要: # Booleans & Comparison Operators # True # False # = # == # != # # = # if statements num1 = 100 num2 = 100 if num1 > num2: #this is not true, so it's gonna print the later statement print... 阅读全文
posted @ 2017-07-11 00:04 mxyzptlk 阅读(165) 评论(0) 推荐(0)
摘要: import random health = 50 difficulty = 1 portionHealth = int(random.randint(20,50) / difficulty) health = health + portionHealth print(health) 阅读全文
posted @ 2017-07-10 23:22 mxyzptlk 阅读(88) 评论(0) 推荐(0)
摘要: monthsofyear = 'JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember' monthof1 = monthsofyear[0:7:1] print(monthof1) monthof2 = monthsofyear[7:15:1] print(monthof2) monthof3 = m... 阅读全文
posted @ 2017-07-10 22:19 mxyzptlk 阅读(176) 评论(0) 推荐(0)
摘要: pwd pwd print working directory cd ~ back to home directory mkdir make a directory cd change dicrectory ls list directory rmdir remove empty directory pushd save current dir & go to d... 阅读全文
posted @ 2017-07-10 16:17 mxyzptlk 阅读(141) 评论(0) 推荐(0)
摘要: text = 'happy python learning' print(text.count('n')) text = text.upper() print(text) text = text.capitalize() print(text) text = text.title() print(text + '\n') text = ' 000000happy python learn... 阅读全文
posted @ 2017-07-09 22:46 mxyzptlk 阅读(118) 评论(0) 推荐(0)
摘要: name = input('What is your name?\n') age = input('How old are you?\n') location = input('Where are you from?\n') hobby = input('What do you like?\n') result = 'Hello {}, age of {}, from {}, and you ... 阅读全文
posted @ 2017-07-09 22:29 mxyzptlk 阅读(145) 评论(0) 推荐(0)