Python 3 programming model basic.
Hello world
print ("Hello world")
Results
Hello world in Python 3 |
You will see that the Python 3 programming model is simple.
Simple sum program.
This program is used primarily by inherited and then using if else then show results.
#!/usr/bin/python
#-*-coding: utf-8 -*-
print ("Program + or -")
print ("Build by Wannaphong")
print ("18/10/2013")
print ("1.+ 2. -")
x = int(input("input: "))
if x == 1:
a = int(input("input1: "))
b = int(input("input2: "))
print ("=" , a + b)
elif x == 2:
c = int(input("input1: "))
d = int(input("input2: "))
print ("=" , c - d)
elif x & 1 or x & 2:
print ("No!. You input'n 1 or 2.")
Results
Simple sum program |
Thank you
No comments:
Post a Comment