+ 5

how to use python when creating a site? need sample code

https://www.sololearn.com/discuss/2099281/?ref=app

16th Dec 2019, 3:56 PM
Petr
10 ответов
+ 5
Petr, there are many tutorials online about back-end. First, you must know python itself ofc (you should have a strong knowledge of concepts like conditionals, loops, functions, and classes). You also need to have some basics about databases and servers. Note that this does not mean you will completly dump HTML, CSS, and JavaScript, because they are essential in front-end. Look up Django or Flask to get started (there are many other frameworks available if you don't like these). Check out a channel named Corey Schafer for both of these topics.
16th Dec 2019, 5:16 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 6
16th Dec 2019, 5:35 PM
Petr
+ 5
Aymane Boukrouh [Unavailable] Ok. And what i need study to know back-end ? Brython is not good for my idea.
16th Dec 2019, 5:11 PM
Petr
+ 5
Aymane Boukrouh [Unavailable] Thanks. I know sql, py, c++, but i dont understand how i can connect all of these:)) i hope your recomendation will help me.
16th Dec 2019, 5:20 PM
Petr
+ 4
Aymane Boukrouh [Unavailable] How i can check out a channel by name? May be you have a link for his code or post?
16th Dec 2019, 5:31 PM
Petr
+ 3
Python is used as a back-end programming language for managing websites. There are many frameworks that you can use, such as Flask and Django. However, there is also an option to use it as a front-end programming language, using Brython. I have never tried Brython, just seen people writing about it, you should probably check it out.
16th Dec 2019, 5:07 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
Petr C++ is not needed. For sql, you must have access to a database server (Examples: MySQL, postgresql...). There are frameworks for that as well, that allow you to excute queries with python. Ifyou know sql then it's no big deal and you'll understand how it works in very few hours, or less. For HTML, CSS, and JavaScript, they are connected in different ways, you should know how to write in all three languages (or at least HTML and CSS) in order to be able to make good websites. Then again, it's all about adding HTML code to your python code using the frmaeworks mentioned before (Flask, Django..). But, since python is for back-end, you are required to be able to read HTML, not necessarly write in it.
16th Dec 2019, 5:25 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
from math import * print ("Hello sir! welcome to Rabbit calculator...") def options(): print("------------------------------------------------------------------") print("Options: ") print ("------------------------------------------------------------------") print("Enter '+' to add two numbers") print("Enter '-' to subtract two numbers") print("Enter '*' to multiply two numbers") print("Enter '/' to divide two numbers") print("Enter '**' to power two numbers") print("Enter '&' to square root ") print("Enter 'exit' to exit the calculator") print("------------------------------------------------------------------") #divide function def divide(): try: num1, num2 = float(input("Enter first number: ")), float(input("Enter second number: ")) result = num1 / num2 print("The answer: ", result,"\n") except ZeroDivisionError: print ("Error: division by zero is not possible!") divide() finally: x = input ("wanna continue? (y/n) ") if x == "y" or x == "Y": divide() else: exit #Add function def add(): try: num1,num2 = float(input("Enter first number: ")),float(input("Enter second number: ")) result = num1 + num2 print ("The answer: ",result,"\n") except: print ("An error ooccured!") finally: r = input ("wanna continue? (y/n) ") if r == "y" or r == "Y": add() else: exit #Subtract function def subtract(): try: num1, num2 = float(input("Enter first number: ")), float(input("Enter second number: ")) result = num1 - num2 print("The answer: ", result,"\n") except: print ("An error ooccured!") finally: z = input ("wanna continue? (y/n) ") if z == "y" or z == "Y": subtract() else: exit #Multiply function def multiply(): try: num1, num2 = float(i
18th Dec 2019, 9:34 AM
Farhang.Ramezani
Farhang.Ramezani - avatar
+ 2
I dont know
18th Dec 2019, 10:02 AM
Armin Amiri Nasab
Armin Amiri Nasab - avatar