UbuntuIn the system, Python version 2.7.x is installed by default, and python command is executed directly. Pthon version 2.7.x will be opened; Python version 3 needs to be installed by itself, and after successful installation, Python 3 will open pyt.Hon 3.x version.
pythonIt is installed in the /usr/bin directory; the python library is installed in /usr/local/lib/python XX. XX is the version number.
This article introduces the installation of Python source code in Ubuntu system:
Official website download source: WGet https://www.python.org/ftp/python/3.5...
This article is used to record built-in functions in Python. andIts functions are supplemented at any time.
Complete built-in functions and their descriptions are available in the official documentation: https://docs.python.org/3.5/library/functions.html
Universal built in function:
id() Function: look at the memory address of the object;
help()Function: view help information;
type()Function: look at the type of the object; do not think that the subclass is a parent type.
isinstance()Function: view object type; think subclass is a kind of parent...
This article is used to record standard modules in Python and update at any time.
decimalModule (solving fractional circulation problem):
>>> import decimal
>>> a = decimal.Decimal(‘10.0’)
>>> b = decimal.Decimal(‘3’)
>>> a / b
Decimal(‘3.333333333333333333333333333’)
fractionsModule (solving fractional presentation problem):
>>> from fractions import Fraction
>>> Fraction(10, 3)
Fraction(10, 3)
>>> Fraction(10, 4)
Fraction(5, 2)
>>> Fraction(6, 2)
Fraction(3, 1)
This article is used to record standard class libraries in Python. The contents of this article are updated at any time.
math(Mathematical operations):
>>> import math
>>> math.pi
3.141592653589793
>>> math.ceil(5.2)
6
>>> math.floor(9.9)
9
>>> math.pow(4, 2)
16.0
>>> math.sqrt(9)
3.0
>>> math.fabs(-2)
2.0
>>> math.fmod(5, 3)
2.0
1、The essence of Internet is a series of network protocols.
A hard-wired operating system, then loaded with software you can use normally, but you can only use it yourself.
Like this, everyone has a machine of their own, but they are isolated from each other.
English has become the universal standard of communication for all people in the world. If you look at computers as people all over the world, the Internet that connects two computers actually means
A series of unified standards, these standards are called Internet Protocol, the essence of the Internet is a series of protocol...
Campus management system (02)Demand:From the "student elective system" these words can be seen, our core function is actually only elective courses.Role:Student administratorFunction:Landing: administrators and students can login and automatically distinguish their identity after landing.chooseLesson: students are free to choose courses for themselves.Create Users: The course selection system is for our students, so all users should be done by the administratorbecomeLook at the course selection: each student can check his own course selection, and the administrator should be able to check it...
> function takes two dimensional array sorting:
The array format is as follows:
$goods = array(
0 => array(
“id”=>1,
“tag”=>array(
“price”=>”10”,
“old_price”=>”20”
)
),
1 => array(
“id”=>2,
“tag”=>array(
“price”=>”30”,
“old_price”=>”100”
)
),
2 => array(
“id”=>3,
“tag”=>array(
“price”=>”25”,
“old_price”=>”70”
)
...
This article is aimed only at novice, I hope you do not spray, thank you! If you don’t say much, you should first code.
import random
if __name__ == '__main__':
yourname = input("Hello! What's your name? \n");
print ("Welcome to guessing game." + yourname)
print ("I guess a number is between 1 and 20. Can you guess it?")
random_num = random.randint(1,20)
time = 0
while time < 5:
num = int(input("Please input your number:"))
if num == random_num:
break;
elif num < random_num:
print ("Smaller than mine.")
...