# Chapter 4 Programming Exercise 3 # Mass and Weight program def main(): # User enters mass mass = input("Enter mass in kilogram: ") function(mass) def function(mass): # Calcuatlion in newtons (weight = mass * 9.8) weight = mass * 9.8 if weight >= 1000: print 'The object is too heavy.' elif weight <= 10: print 'the object is too light.' else: print 'The corresponding weight in newtons is ', weight, 'newtons.' main()
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