Python mining code
Publish: 2021-05-21 06:40:52
1. You can download its source code from the official website of Python
https://www.python.org/downloads/source/
https://www.python.org/downloads/source/
2.
numbers=[]
while True:
n=input()
numbers.append(n)
if len(numbers)==5:
numbers.sort(reversed=False)
print(numbers)
break
3. k=0
while k>= 0:
if 5**(3**k)%2 == 3:
print(k)
break
k += 1
while k>= 0:
if 5**(3**k)%2 == 3:
print(k)
break
k += 1
4. Input two numbers, compare the sizes, and then output
def cmpnum():
A = input (& quot; Please enter a number: & quot;)< br />b = input(" Please enter a number: & quot;)< br />if a >= b:
Print (a, b)
else:
Print (B, a)
cmpnum()
result 1:
please enter a number: 159
please enter a number: 456
456 159
result 2:
please enter a number: 9568
please enter a number: 1452
9568 1452
def cmpnum():
A = input (& quot; Please enter a number: & quot;)< br />b = input(" Please enter a number: & quot;)< br />if a >= b:
Print (a, b)
else:
Print (B, a)
cmpnum()
result 1:
please enter a number: 159
please enter a number: 456
456 159
result 2:
please enter a number: 9568
please enter a number: 1452
9568 1452
5. include <QtCore/QCoreApplication>
#include <QAxObject>
#include <Windows.h>
int main(int argc, char *argv[])
{
//OleInitialize(0);
//CoInitialize(0);
QCoreApplication a(argc, argv);
QAxObject *asdfg = new QAxObject("Excel.Application");
return a.exec();
}
#include <QAxObject>
#include <Windows.h>
int main(int argc, char *argv[])
{
//OleInitialize(0);
//CoInitialize(0);
QCoreApplication a(argc, argv);
QAxObject *asdfg = new QAxObject("Excel.Application");
return a.exec();
}
6.
defgetsubset(myset,subtract):
iflen(myset)<=1:
return[]
result=[]
newsubtract=subtract.()
foriinsubtract:
result.append(myset-{i})
newsubtract=newsubtract-{i}
result.extend(getsubset(myset-{i},newsubtract))
returnresult
defsubset(myset):
result=[set(),myset]ifmysetelse[myset]
result.extend(getsubset(myset,myset))
returnresult
result=subset({'a','b','c','d'})
toprint=[sorted(x)forxinresult]
foriinsorted(toprint,key=lambdax:(len(x),x)):
print(i)
虽然这对我来说的确比较简单,可也不是几分钟就能写出来的,好歹给点分吧
而且(a,b,a,c) 不是集合,集合中元素不应有重复
一个n个元素的集合的所有子集是2的n次方个吗,如是,这个程序应该就是正确的
7.
This one is relatively simple
First of all, we need to know how to judge whether the year is a leap year. This function can judge:
the code is finished. The test passed
8. a= {#39; Language & #39;: 80, & #39; Number & #39;: 90, & #39; English & #39;: 100.5}
sum=0
for key in a:
sum+=a[key]
avg=sum / len(a)
print (" Average achievements: %s " %
sum=0
for key in a:
sum+=a[key]
avg=sum / len(a)
print (" Average achievements: %s " %
9. Innocent and ridiculous
it's a prison sentence to use a crawler to capture the system openly. Even if there is such a code, it is expensive
it's a prison sentence to use a crawler to capture the system openly. Even if there is such a code, it is expensive
Hot content