简体   繁体   English

是否可以使用 python 和 django 制作数学公式应用程序?

[英]Is it possible to make a maths formula app using python and django?

I have been wondering if it is possible to make a math formula app using python or some kind of website with django.我一直想知道是否可以使用 python 或某种带有 django 的网站制作数学公式应用程序。 I want to refer it every time i need because there are tons of mathematics formulas and i don't want to memorize them.我想在每次需要时参考它,因为有大量的数学公式,我不想记住它们。 It would be easier if it is anything i can refer it anytime.如果我可以随时参考它会更容易。

Yes, this probably would be possible.是的,这可能是可能的。 If you want to save time you can do it wholly with python as a command-line application.如果您想节省时间,您可以完全使用 python 作为命令行应用程序来完成。 I recently did one for quadratic equations, see code below:我最近为二次方程做了一个,见下面的代码:

import math


def int_input(prompt):
    while True:
        try:
            variable_name = int(input(prompt))
            return variable_name
        except ValueError:
            print("Please enter a whole number (in digits)")


def float_input(prompt):
    while True:
        try:
            variable_name = float(input(prompt))
            return variable_name
        except ValueError:
            print("Please enter a numeric value (in digits)")


def yes_input(prompt):
    while True:
        variable_name = input(prompt).lower()
        if variable_name in ["y", "yes"]:
            return "yes"
        elif variable_name in ["n", "no"]:
            return "no"
        else:
            print("""Please enter either "y" or "n". """)


print("Quadratic Solver")

while True:

    print("Input below the values of a, b and c from an equation that is of the form : ax² + bx + c = 0")
    a = float_input('a: ')

    b = float_input('b: ')

    c = float_input('c: ')

    # calculate the discriminant
    d = (b ** 2) - (4 * a * c)

    # find two solutions
    solution1 = (-b - math.sqrt(d)) / (2 * a)
    solution2 = (-b + math.sqrt(d)) / (2 * a)

    if solution1 == solution2:
        print("There is one solution: x = {0}".format(solution1))

    elif solution1 != solution2:
        print('There are two solutions, x can be either {0} or {1}'.format(solution1, solution2))

    new_question = yes_input('New question? (y/n): ')
    if new_question == "no":
        break

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以在 Django 中制作移动应用程序? - Is it possible to make a mobile app in Django? 使用字符串存储分数以进行python数学测验 - Using strings to store scores for a python maths quiz 是否可以将我的 Python 应用程序使用 Eel 制作成网站 - Would it be possible to make my Python App made using Eel a Website 是否可以制作一个使用 Python 检测其他设备位置的应用程序? - Is it possible to make an app that detects other devices location using Python? 在Python 2.7.3中使用eval求解数学表达式 - Using eval in Python 2.7.3 to solve a maths expression 如何在Django应用程序中进行Facebook登录? - How to make Facebook Login possible in Django app ? 是否可以使用python复制单元格的Excel公式而不是值? - Is it possible to copy the Excel formula of a cell instead of the value using python? 使用迭代公式计算函数的所有可能值(python) - Using an iterative formula to calculate all possible values of a function (python) 在不使用多个函数的情况下使用python评估数学表达式的算法 - Algorithm for evaluating maths expressions using python without using multiple functions 是否可以使用python支持的框架Django开发本机移动应用程序的后端? - Is it possible to develop the back-end of a native mobile app using the python powered framework Django?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM