<center> </center> If you're interested in learning coding this is a basic calculator you can use and play around with. Its also on github. https://github.com/PaulMoon410/learn_calc Python Coded #### clock.py ````html # Thank you to those at Learn To Code on Hive.io # adds two numbers def add(x, y): return x + y # subtracts two numbers def subtract(x, y): return x - y # multiplies two numbers def multiply(x, y): return x * y # divides two numbers def divide(x, y): return x / y print("Select operation.") print("1.Add") print("2.Subtract") print("3.Multiply") print("4.Divide") while True: # input from the user choice = input("Enter choice(1/2/3/4): ") # check if choice is one of the four options if choice in ('1', '2', '3', '4'): try: num1 = float(input("Enter first number: ")) num2 = float(input("Enter second number: ")) except ValueError: print("Invalid input. Please enter a number.") continue if choice == '1': print(num1, "+", num2, "=", add(num1, num2)) elif choice == '2': print(num1, "-", num2, "=", subtract(num1, num2)) elif choice == '3': print(num1, "*", num2, "=", multiply(num1, num2)) elif choice == '4': print(num1, "/", num2, "=", divide(num1, num2)) # check if user wants another calculation # break the while loop if answer is no next_calculation = input("Let's do next calculation? (yes/no): ") if next_calculation == "no": break else: print("Invalid Input")
author | paulmoon410 |
---|---|
permlink | basic-calculator-learning-to-code |
category | hive-188262 |
json_metadata | "{"app":"ecency/3.2.0-vision","description":"So... its a calculator","format":"markdown+html","image":["https://images.ecency.com/DQmT6JB3C3LGfDXWnuMYuCcVFdknKbXrywUQakGHfKnuYzC/image.png"],"image_ratios":["1.0000"],"tags":["hive-188262","neoxian","pimp","palnet","waivio","ctp","lassecash","creativecoin","proofofbrain","cent","lern","ecency","ecency"],"thumbnails":["https://images.ecency.com/DQmT6JB3C3LGfDXWnuMYuCcVFdknKbXrywUQakGHfKnuYzC/image.png"]}" |
created | 2024-06-01 23:52:45 |
last_update | 2024-06-02 15:02:51 |
depth | 0 |
children | 4 |
last_payout | 2024-06-08 23:52:45 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.444 HBD |
curator_payout_value | 0.440 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,736 |
author_reputation | 40,634,639,847,637 |
root_title | "Basic Calculator - Learning to Code" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 134,131,583 |
net_rshares | 2,114,422,048,599 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
good-karma | 0 | 41,759,022,921 | 4% | ||
chrisaiki | 0 | 252,864,688,182 | 100% | ||
esteemapp | 0 | 10,687,457,872 | 4% | ||
bloghound | 0 | 505,448,540 | 0.8% | ||
ironshield | 0 | 71,943,671,686 | 100% | ||
drwom | 0 | 835,923,587 | 2% | ||
sorin.cristescu | 0 | 10,899,784,634 | 2% | ||
esteem.app | 0 | 1,412,895,938 | 4% | ||
cherryng | 0 | 493,859,006 | 0.8% | ||
catharsis | 0 | 2,330,041,842 | 3% | ||
bhattg | 0 | 6,531,336,221 | 3% | ||
sbi8 | 0 | 49,321,148,492 | 9.8% | ||
randomvoter | 0 | 12,623,670,424 | 25% | ||
sbi-tokens | 0 | 744,342,822 | 0.77% | ||
ecency | 0 | 1,573,454,936,317 | 4% | ||
hivecannabis | 0 | 3,756,362,676 | 42% | ||
ecency.stats | 0 | 1,569,519,902 | 4% | ||
photolovers1 | 0 | 3,175,097,173 | 3% | ||
marshmellowman | 0 | 9,387,131,013 | 55% | ||
arc7icwolf | 0 | 46,148,216,151 | 50% | ||
mmoonn | 0 | 1,671,175,444 | 100% | ||
dr-animation | 0 | 1,654,725,249 | 100% | ||
allentaylor | 0 | 692,777,448 | 2% | ||
peakecoin | 0 | 7,268,810,533 | 100% | ||
manros11 | 0 | 2,149,884,059 | 59% | ||
mviews | 0 | 0 | 100% | ||
learn2code | 0 | 540,120,467 | 25% | ||
lolz.byte | 0 | 0 | 100% | ||
arc7icwolf.byte | 0 | 0 | 100% | ||
bbarelyseal | 0 | 0 | 100% | ||
lleaguelake | 0 | 0 | 100% |
Something I can understand, finally! Ahahah Curated by @arc7icwolf.byte for the #LearnToCode community.
author | arc7icwolf |
---|---|
permlink | re-paulmoon410-202465t14610130z |
category | hive-188262 |
json_metadata | {"tags":["hive-188262","neoxian","pimp","palnet","waivio","ctp","lassecash","creativecoin","proofofbrain","cent","lern","ecency","ecency"],"app":"ecency/3.2.0-vision","format":"markdown+html"} |
created | 2024-06-05 12:06:12 |
last_update | 2024-06-05 12:06:12 |
depth | 1 |
children | 1 |
last_payout | 2024-06-12 12:06:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 104 |
author_reputation | 504,569,010,043,585 |
root_title | "Basic Calculator - Learning to Code" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 134,224,374 |
net_rshares | 0 |
After using what I know the other code is way simpler when you use all of Hives APIs.
author | paulmoon410 |
---|---|
permlink | re-arc7icwolf-202465t214348725z |
category | hive-188262 |
json_metadata | {"type":"comment","tags":["hive-188262","neoxian","pimp","palnet","waivio","ctp","lassecash","creativecoin","proofofbrain","cent","lern","ecency","ecency"],"app":"ecency/3.1.2-mobile","format":"markdown+html"} |
created | 2024-06-06 01:43:48 |
last_update | 2024-06-06 01:43:48 |
depth | 2 |
children | 0 |
last_payout | 2024-06-13 01:43:48 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 85 |
author_reputation | 40,634,639,847,637 |
root_title | "Basic Calculator - Learning to Code" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 134,267,342 |
net_rshares | 0 |
Keep up the good work!
author | ironshield |
---|---|
permlink | re-paulmoon410-202461t222255293z |
category | hive-188262 |
json_metadata | {"tags":["hive-188262","neoxian","pimp","palnet","waivio","ctp","lassecash","creativecoin","proofofbrain","cent","lern","ecency"],"app":"ecency/3.2.0-vision","format":"markdown+html"} |
created | 2024-06-02 02:23:06 |
last_update | 2024-06-02 02:23:06 |
depth | 1 |
children | 0 |
last_payout | 2024-06-09 02:23:06 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 22 |
author_reputation | 648,787,896,432,262 |
root_title | "Basic Calculator - Learning to Code" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 134,133,427 |
net_rshares | 0 |
!WINE
author | ironshield |
---|---|
permlink | re-paulmoon410-202461t222317z |
category | hive-188262 |
json_metadata | {"tags":["hive-188262","neoxian","pimp","palnet","waivio","ctp","lassecash","creativecoin","proofofbrain","cent","lern","ecency"],"app":"ecency/3.2.0-vision","format":"markdown+html"} |
created | 2024-06-02 02:23:12 |
last_update | 2024-06-02 02:23:12 |
depth | 1 |
children | 0 |
last_payout | 2024-06-09 02:23:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 5 |
author_reputation | 648,787,896,432,262 |
root_title | "Basic Calculator - Learning to Code" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 134,133,429 |
net_rshares | 0 |