# This is a comment (line comment) is not part of the code # you should comment your code # Program name Ex01 ''' This is block comment Name student Date any day Copy Wrong ..... ''' # Print a message print 'Hello World!' print '\n Hello APUS and Python' # \n = new line # the following two lines will print on one line # it is the "," print ' My Name is prof Ymmas Azaba' , print ' and I will be your instructor for this course' , print ' \n This is ENTD200 ' # Part II using variables #Initialize a variable with an integer value. var = 7 print var #Assign a string value to the variable. var = 'Python is fun' print var #Assign a Boolean value to the variable. var = True print var #Get user input myname=0 myname = raw_input("What is your name ? ") print "My name is ", myname print "My name is " + myname #Let's do some math a = 8 b = 2 print 'Addition:\t' , a , '+', b , '=' , a + b print 'Subtraction:\t' , a , '-', b , '=' , a - b print 'Multiplication:\t' , a , 'x', b , '=' , a * b print 'Division:\t' , a , '/', b , '=' , a / b print 'Floor Division:\t' , a , '//', b , '=' , a // b print 'Modulus:\t' , a , '%', b , '=' , a % b
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