Hello,World
print ("Hello, World!")
Hello, World!
2+2
4
53672+235253
288925
1/2
0.5
1.0/2.0
0.5
1/2.0
0.5
1/2.
0.5
from __future__ import division
1/2
0.5
1//2
0
1.0//2.0
0.0
1%2
1
10/3
3.3333333333333335
10//3
3
10%3
1
** 乘法 **
2 * 3
6
2 ** 3
8
0xAF
175
0o10
8
0b11
3
x = 2
x * 2
4
y = x
x = 1
y
2
2 * 2
4
print (2*2)
4
input("The meaning of life:")
The meaning of life:42
'42'
x = input("x:")
x:2
y = input("y:")
y:3
x= int(x)
y = int(y)
print (x*y)
6
if 1==2:
print('One equals Two')
if 1 ==1:
print('One equals One')
One equals One
2 ** 3
8
pow(2,3)
8
abs(-10)
10
round(1.0/2.0)
0
import math
math.floor(32.9)
32
float(math.floor(32.9))
32.0
from math import sqrt
sqrt(9)
3.0
int(sqrt(9))
3
import cmath
cmath.sqrt(-1)
1j
(1+3j)*(9+4j)
(-3+31j)
"Hello,Python"
'Hello,Python'
'Hello,Python'
'Hello,Python'
"let\'s go!"
"let's go!"
"\"Hello,Pyrhon\""
'"Hello,Pyrhon"'
x= 'Hello,Python,'
y= "let\'s go!"
print(x+y)
Hello,Python,let's go!'
repr("Hello,World!")
"'Hello,World!'"
str("hello,World!")
'hello,World!'
abs(-10)
10
cmath.sqrt(-9)
3j
float(3)
3.0
help()
Welcome to Python 3.6's help utility! If this is your first time using Python, you should definitely check out the tutorial on the Internet at https://docs.python.org/3.6/tutorial/. Enter the name of any module, keyword, or topic to get help on writing Python programs and using Python modules. To quit this help utility and return to the interpreter, just type "quit". To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics". Each module also comes with a one-line summary of what it does; to list the modules whose name or summary contain a given string such as "spam", type "modules spam". help> abs Help on built-in function abs in module builtins: abs(x, /) Return the absolute value of the argument. help> You are now leaving help and returning to the Python interpreter. If you want to ask for help on a particular object directly from the interpreter, you can type "help(object)". Executing "help('string')" has the same effect as typing a particular string at the help> prompt.
input(x)
Hello,Python,a
'a'
int(3.0)
3
math.ceil(2.5)
3
math.floor(2.5)
2
math.sqrt(9)
3.0
pow(2,3)
8
repr("Hello,World!")
"'Hello,World!'"
round(2.21323531453465)
2
str("Hello,World~")
'Hello,World~'