# at bat famer1 = ['Babe Ruth'] famer2 = ['Mark McGwire'] famer3 = ['Barry Bonds'] print ("Batters: Babe Ruth, Mark McGwire, Barry Bonds") batter = raw_input("Please enter name of batter to display statistics: ") if batter in famer1: print ("Babe Ruth's HRs = 54, AB = 457, and AB/HR = 8.4630"); elif batter in famer2: print ("Mark Mcqwire's HRs = 70, AB = 509, and AB/HR = 7.2714"); elif batter in famer3: print ("Barry Bonds' HRs = 73, AB = 476, AB/HR = 6.5205"); else: print 'Invalid Batter' name = raw_input("Please enter name of batter who you want to calculate Average of: ") print ("How many At Bats does the player have?: ") ab = input () print ("How many Homeruns has the player hit?: ") hr = input () print name print ("has a AB/HR of...: ") print (ab/hr)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question