My first underprogram "Moronic calculator" (UA|EN)

avatar

Перші дні вивчення основ puthon позаду. Після першого враження після теорії, що все тут просто я приступив до практики. Практика виявилась доволі жорстокою. Виявляється, НАВІТЬ один зайвий чи відсутній відступ (пробел) може легко викликати помилку в коді, на пошук якої часто витрачається значно більше часу чи на написання всього коду. Це перший доволі відчутній урок, що я засвоїв за час своєї практики. Ось чому в програмуванні потрібно бути на 200% сконцентрованому саме на програмуванні.

The first days of learning the basics of puthon are behind us. After the first impression after the theory that everything is here, I just started to practice. The practice turned out to be quite cruel. It turns out that EVEN one extra or missing indent (space) can easily cause an error in the code, which often takes much more time to find or to write all the code. This is the first quite tangible lesson I have learned during my practice. That is why in programming you need to be 200% focused on programming.

image.png

Прийшов час хвастатись, розумію, що для більшості людей, що вже знають код програмування python, те що я написав може видатись смішним, але я пишаюсь тим, що сам це написав (по шаблону, дивлячись відео) і тим, що я розібрався що таке модулі, умови, команди, функції, тайпкастінг, конкатенація, екранування та перевід ліній. Майже всі ці слова є в цьому примітивному коді (за виключенням переводу ліній). Якщо хтось захоче запустити мій дебільний калькулятор в себе на комп’ютері ось код.

It's time to brag, I understand that for most people who already know the python programming code, what I wrote may seem ridiculous, but I'm proud that I wrote it myself (according to a template, watching a video) and that I understood what it is modules, conditions, commands, functions, typing, concatenation, screening and line translation. Almost all of these words are in this primitive code (except for the translation of lines). If anyone wants to run my stupid calculator on their computer, here's the code.

# My debil calculator
from colorama import init
from colorama import Fore, Back, Style

# use Colorama to make Termcolor work on Windows too
init()

print( Fore.BLACK )
print( Back.GREEN )

what = input( "What do now? (+, -)")

print( Back.CYAN )

a = float( input("first number: ")) 
b = float(input("second number: "))

print( Back.YELLOW )

if what == "+":
        c = a + b
        print("result: " + str(c))
elif what == "-":
        c = a - b
        print("result: " + str(c))

else:
        print ("wrong combination selected")

Хто молодець? – Я молодець :D

Who's joyful? - I'm joyful: D

"Life is the best "GAME". In this "GAME", there is no place for other games!"

create hive blockchain account

Not got an account yet? Sign up to Hive!

Posted in HIVEUAJoin Team Ukraine Social Media
image.pngJoin the community!image.pngTelegram Chat - Twitter



0
0
0.000
7 comments
avatar

От друкарські помилки - це одна з причин, чому я вирішив спочатку освоїти набір сліпим методом на латиниці, аби хоч трохи зменшити кількість помилок.

Вітаю! Гарний початок :)

0
0
0.000
avatar

Дякую, сам задоволений. Думаю скоро і мені доведеться опановувати сліпий ввід даних. Я тричі починав і далі 5 уроку ще не заходив.

0
0
0.000
avatar

Oh, @cranium, so you are starting to learn Python?

0
0
0.000
avatar

Yep, It's time, I wanted to. I think it not definitely interfere with the development for different plans. And the main goal of the development/use of trading bots pushed to this.

0
0
0.000
avatar

О, бачу ви обрали редактор SublimeText

0
0
0.000
avatar

Поки так, але хочу ще спробувати Visual Studio и
Visual Studio Code

0
0
0.000