# Week 3 Ex 3: This program converts an objects’s Mass in Kg to Weight in Newtons and displays either too heavy if more than 1,000 Newtons or too light if less than 10 Newtons # Written by Greg Lamb. # Last modified on 04/10/2015 #Get object’s Mass in Kg MassKg=raw_input('Enter Mass in Kg: ') print MassKg Nwtns=0 #Calculate weight in Newtons Nwtns=float(MassKg) * 9.8 print Nwtns #Display weight in Newtons print('Object weight in Newtons is: {}'.format(Nwtns)) #Determine if object is too heavy if Nwtns > 1000: print 'Object is too heavy' #Determine if object is too light if Nwtns < 10: print 'Object is too light'
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