mirror of
https://github.com/efecini/mooniversity_examples.git
synced 2025-04-19 10:51:21 +00:00
Interations
This commit is contained in:
parent
2e952c6746
commit
a27438b6cb
26
3_digital_signatures
Normal file
26
3_digital_signatures
Normal file
@ -0,0 +1,26 @@
|
||||
### Digital Signatures ###
|
||||
|
||||
from helpers import mainnet,testnet
|
||||
from pprint import pprint
|
||||
|
||||
#sign and verify messages like this: signmessage "address" "message"
|
||||
|
||||
#First we have to get an address:
|
||||
address = testnet.getnewaddress('','legacy')
|
||||
print(f"Address created with private key is:{address}")
|
||||
|
||||
#Create our message. Just a basic string
|
||||
msg = 'this is a message'
|
||||
print(f"Message is:{msg}")
|
||||
|
||||
#Create the signature by signing the address with a message. It returns you a signature
|
||||
signature = testnet.signmessage(address, msg)
|
||||
print(f"Signature created with address for the message {msg} is:{signature}")
|
||||
|
||||
#Verify that our signature is valid with my address for 'my message' msg
|
||||
verified = testnet.verifymessage(address, signature, 'this is a message')
|
||||
print(f"Verified?:{verified}")
|
||||
|
||||
#If you try the worng msg to sign, it will print false.
|
||||
verified2 = testnet.verifymessage(address, signature, 'this is a message too')
|
||||
print(f"Verified?:{verified2}")
|
@ -2,7 +2,7 @@ from helpers import mainnet
|
||||
from decimal import Decimal
|
||||
|
||||
def calculate_bitcoin_cycle_and_block_reward():
|
||||
#This little program tells you the bitcoin's cycle count and the bitcoin block reward amount
|
||||
#This little program gives the bitcoin's cycle count and the bitcoin block reward amount
|
||||
INITIAL_SUBSIDY = Decimal(50)
|
||||
BLOCKS_PER_HALVENING = 210000
|
||||
last_block = mainnet.getblockchaininfo()["blocks"]
|
||||
|
24
my2.py
Normal file
24
my2.py
Normal file
@ -0,0 +1,24 @@
|
||||
"""
|
||||
_ = set(map(int, input().split()))
|
||||
arr = input().split()
|
||||
s1 = set(map(int, input().split()))
|
||||
s2 = set(map(int, input().split()))
|
||||
|
||||
print(s1)
|
||||
print(s2)
|
||||
print(s3)
|
||||
print(sum([(i in s1)-(i in s2) for i in arr]))
|
||||
|
||||
n, m = raw_input().split()
|
||||
|
||||
sc_ar = raw_input().split()
|
||||
|
||||
A = set(raw_input().split())
|
||||
B = set(raw_input().split())
|
||||
print sum([(i in A) - (i in B) for i in sc_ar])
|
||||
"""
|
||||
A = set(input().split())
|
||||
B = set(input().split())
|
||||
print(A)
|
||||
print(B)
|
||||
print(A.issuperset(B))
|
Loading…
x
Reference in New Issue
Block a user