What's new

Pa check naman po sa Python ko.

PHC - NoName

Eternal Poster
Joined
Sep 27, 2021
Posts
439
Reaction
78
Points
269
Mga sir pa help naman po dito. Bali may pinapagawa po samin Yung teacher namin. Bali po ang title nya is EXAM APPLICATION PROGRAM. dapat po. Sa first page dapat po nakalagay doon yung Gumawa(Developer)

Tapos sa 2nd page naman po yung fullname ng gagamit.

Then pagka NEXT po

Sa susunid na pages kaylangan po may question po doon na isa at kaylangan po sagutun ng user.

So bali 10 questions po.. Pero kada next po may panibagong tanong. So dapat po. Kada pages po ay isang sagot lang po

Then after mapatapos at masagutan yung tanong. Sa dulo po makikita yung questions at answer ng sama-sama napo.

Eto po yung gawa ko. Malapit nanaman po sya pero nalilito lang po. Ako.

You do not have permission to view the full content of this post. Log in or register now.

Pa up po. Please
 

Attachments

Last edited:
Do you have a structure in mind for your website? For #1, that is your name right? As the developer, I mean. For #2, you can simply use a template page for your questions. Meaning just make a question and answer page then you use Flask to render the template by sending the necessary questions. Making #3 and #4 obsolete, there's no need for having 10 web pages but if it's a requirement then don't use this method. #5 is just simply summarizing the data you have.

Though if it were me, using a dictionary or list is much better than creating 10 variables although it seems your teacher/professor requires you to make 10 variables so I guess you will have to follow them. You can try the simplest, oldest, and not charming method. Something like this
Code:
index.html
question1.html
question2.html
...
question10.html
summary.html

I forgot to mention you can use POST requests to acquire data in your server. Then as for storing them, either save it in memory or use sqlite database. Also you can use flask's query strings.
 
Last edited:
Do you have a structure in mind for your website? For #1, that is your name right? As the developer, I mean. For #2, you can simply use a template page for your questions. Meaning just make a question and answer page then you use Flask to render the template by sending the necessary questions. Making #3 and #4 obsolete, there's no need for having 10 web pages but if it's a requirement then don't use this method. #5 is just simply summarizing the data you have.

Though if it were me, using a dictionary or list is much better than creating 10 variables although it seems your teacher/professor requires you to make 10 variables so I guess you will have to follow them. You can try the simplest, oldest, and not charming method. Something like this
Code:
index.html
question1.html
question2.html
...
question10.html
summary.html
Okay po. Salamay po ng marami

Do you have a structure in mind for your website? For #1, that is your name right? As the developer, I mean. For #2, you can simply use a template page for your questions. Meaning just make a question and answer page then you use Flask to render the template by sending the necessary questions. Making #3 and #4 obsolete, there's no need for having 10 web pages but if it's a requirement then don't use this method. #5 is just simply summarizing the data you have.

Though if it were me, using a dictionary or list is much better than creating 10 variables although it seems your teacher/professor requires you to make 10 variables so I guess you will have to follow them. You can try the simplest, oldest, and not charming method. Something like this
Code:
index.html
question1.html
question2.html
...
question10.html
summary.html

I forgot to mention you can use POST requests to acquire data in your server. Then as for storing them, either save it in memory or use sqlite database. Also you can use flask's query strings.
Dito poba ilalagay kada @app.route?


Ahhh.. Gagawa po uli ng panibagong files? Kada tanong?

Do you have a structure in mind for your website? For #1, that is your name right? As the developer, I mean. For #2, you can simply use a template page for your questions. Meaning just make a question and answer page then you use Flask to render the template by sending the necessary questions. Making #3 and #4 obsolete, there's no need for having 10 web pages but if it's a requirement then don't use this method. #5 is just simply summarizing the data you have.

Though if it were me, using a dictionary or list is much better than creating 10 variables although it seems your teacher/professor requires you to make 10 variables so I guess you will have to follow them. You can try the simplest, oldest, and not charming method. Something like this
Code:
index.html
question1.html
question2.html
...
question10.html
summary.html

I forgot to mention you can use POST requests to acquire data in your server. Then as for storing them, either save it in memory or use sqlite database. Also you can use flask's query strings.
Pano poba gumawa ng input box? For example po. Sa

QUESTIONS1 what is HTML[Hypertext Markup Language]

Ganan po?

Do you have a structure in mind for your website? For #1, that is your name right? As the developer, I mean. For #2, you can simply use a template page for your questions. Meaning just make a question and answer page then you use Flask to render the template by sending the necessary questions. Making #3 and #4 obsolete, there's no need for having 10 web pages but if it's a requirement then don't use this method. #5 is just simply summarizing the data you have.

Though if it were me, using a dictionary or list is much better than creating 10 variables although it seems your teacher/professor requires you to make 10 variables so I guess you will have to follow them. You can try the simplest, oldest, and not charming method. Something like this
Code:
index.html
question1.html
question2.html
...
question10.html
summary.html

I forgot to mention you can use POST requests to acquire data in your server. Then as for storing them, either save it in memory or use sqlite database. Also you can use flask's query strings.
Tama poba ako bali 10 files na index.html kasa isang tanong?

Chen Zhen pwede pobang pa edit neto po? Hirap po kase gumawa sa CP. E hanggang mamaya nalang po yun. Kahiya - hiya man po. Kaylangan lang po talaga.

You do not have permission to view the full content of this post. Log in or register now.

Kahit ako nalang po mag edit ng mga tanong po.
 

Attachments

Last edited:
Dito poba ilalagay kada @app.route?
Ah well since it's per file, yes technically yes. Although you can try using only one @app.route but that would probably take more time than doing it one by one.

Ahhh.. Gagawa po uli ng panibagong files? Kada tanong?
It depends how you want to structure your website. The example I gave above is one question per page, and I'm simply trying to follow the instructions given (#3 and #4). And from what I've said earlier, you can try using only one webpage for those 10 questions.
I am a bit confused if your teacher/professor requires you to have 10 files or simply 10 separate pages to be rendered. If it's the latter, you can just use one template (no need for new file per question)

Pano poba gumawa ng input box? For example po. Sa

QUESTIONS1 what is HTML[Hypertext Markup Language]

Ganan po?
Google is your friend for simple questions like these. I use google majority of the time since I keep forgetting.

Tama poba ako bali 10 files na index.html kasa isang tanong?
It depends if you really want. Refer back to my answer on your 2nd question
 
Ah well since it's per file, yes technically yes. Although you can try using only one @app.route but that would probably take more time than doing it one by one.


It depends how you want to structure your website. The example I gave above is one question per page, and I'm simply trying to follow the instructions given (#3 and #4). And from what I've said earlier, you can try using only one webpage for those 10 questions.
I am a bit confused if your teacher/professor requires you to have 10 files or simply 10 separate pages to be rendered. If it's the latter, you can just use one template (no need for new file per question)


Google is your friend for simple questions like these. I use google majority of the time since I keep forgetting.


It depends if you really want. Refer back to my answer on your 2nd question
Ang sabi po kase ng teacher ko.. Sa isang wep page isang question lang po then pag natapos napo yung 10 na question sa dulo nandun po yung kabuuang sagot.
 
@Chen Zhen pwede pobang pa edit neto po? Hirap po kase gumawa sa CP. E hanggang mamaya nalang po yun. Kahiya - hiya man po. Kaylangan lang po talaga.
Sorry, I can't. I still have some class work to do in a while. Also this will be a good practice for you.

You can try taking a look at my ugly code i've made in the past (still running it as of today)
Python:
from flask import Flask, request, render_template, make_response, send_file
from markupsafe import escape

import random

from scripts import ProfileCounter, general
import keys

from scripts import DatabaseConnector

app = Flask(__name__)



@app.route("/")
def index():
   return "We all know you see the number 727 everywhere. Do not deny it.\n\n Add https://[redacted].pythonanywhere.com/fumos to your osu!me page for random fumos."

@app.route("/settings", methods=["POST"])
def settings():
   sys_pass = request.args.get("727")
   case = request.args.get("option")
   set_value = request.args.get("ckz")

   if general.CheckPassword(sys_pass) == 0:
      pass
   else:
      return "WHEN YOU SEE IT!"

   switch = {"add": ProfileCounter.InsertUser, "reset": ProfileCounter.ResetUser,
             "remove": ProfileCounter.DeleteUser, "set": ProfileCounter.UpdateUser}
   try:
      return switch[case](set_value)
   except Exception as e:
      return f"{e}"

@app.route("/stats")
def player_stats():
   try:
        return f"{DatabaseConnector.Universal.fetchData('profile_counter')}"
   except Exception as e:
      return f"{e}"


@app.route("/view_counter")
def view_counter():
   player = request.args.get("player", type=int)

   try:
      #resp = make_response(render_template("view_counter.svg", page_views = ("%d" % db_profile.viewUser(SETTINGS["Table"], player))))
      resp = make_response(render_template("view_counter.svg",
               page_views = f"{ProfileCounter.ViewUser(player)[0]}",
               color = keys.RGB_CODES[random.randint(0, len(keys.RGB_CODES)) - 1]))
      resp.headers["Content-Type"] = "image/svg+xml"
      resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
      resp.headers["Pragma"] = "no-cache"
      resp.headers["Expires"] = "0"

      return resp

   except:
      return ('', 204)

@app.route("/fumos", methods=["GET"])
@app.route("/fumos1", methods=["GET"])
@app.route("/fumos2", methods=["GET"])
@app.route("/fumos3", methods=["GET"])
@app.route("/fumos4", methods=["GET"])
@app.route("/fumos5", methods=["GET"])
@app.route("/fumos6", methods=["GET"])
def fumos():
   resp = make_response(send_file(f"./fumos/{keys.FUMOS_LIST[random.randint(0, len(keys.FUMOS_LIST)) - 1]}", mimetype="image/gif"))
   resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
   #resp.headers["Pragma"] = "no-cache"
   #resp.headers["Expires"] = "0"

   return resp

@app.route("/num")
def numgen():
   resp = make_response(render_template("num.svg", num = (random.randint(0, 9))))
   resp.headers["Content-Type"] = "image/svg+xml"
   resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
   resp.headers["Pragma"] = "no-cache"
   resp.headers["Expires"] = "0"

   return resp
 
Pwede pobang pa. Sample kung oano gumawa nito? Nalilito po ako e.

QUESTIONS1 what is HTML[Hypertext Markup Language]
 
Ang sabi po kase ng teacher ko.. Sa isang wep page isang question lang po then pag natapos napo yung 10 na question sa dulo nandun po yung kabuuang sagot.
Ah, then I take it as you only need 3 files? One for the home page, one for the questions, and another one for the summary of details
 
Sorry, I can't. I still have some class work to do in a while. Also this will be a good practice for you.

You can try taking a look at my ugly code i've made in the past (still running it as of today)
Python:
from flask import Flask, request, render_template, make_response, send_file
from markupsafe import escape

import random

from scripts import ProfileCounter, general
import keys

from scripts import DatabaseConnector

app = Flask(__name__)



@app.route("/")
def index():
   return "We all know you see the number 727 everywhere. Do not deny it.\n\n Add https://[redacted].pythonanywhere.com/fumos to your osu!me page for random fumos."

@app.route("/settings", methods=["POST"])
def settings():
   sys_pass = request.args.get("727")
   case = request.args.get("option")
   set_value = request.args.get("ckz")

   if general.CheckPassword(sys_pass) == 0:
      pass
   else:
      return "WHEN YOU SEE IT!"

   switch = {"add": ProfileCounter.InsertUser, "reset": ProfileCounter.ResetUser,
             "remove": ProfileCounter.DeleteUser, "set": ProfileCounter.UpdateUser}
   try:
      return switch[case](set_value)
   except Exception as e:
      return f"{e}"

@app.route("/stats")
def player_stats():
   try:
        return f"{DatabaseConnector.Universal.fetchData('profile_counter')}"
   except Exception as e:
      return f"{e}"


@app.route("/view_counter")
def view_counter():
   player = request.args.get("player", type=int)

   try:
      #resp = make_response(render_template("view_counter.svg", page_views = ("%d" % db_profile.viewUser(SETTINGS["Table"], player))))
      resp = make_response(render_template("view_counter.svg",
               page_views = f"{ProfileCounter.ViewUser(player)[0]}",
               color = keys.RGB_CODES[random.randint(0, len(keys.RGB_CODES)) - 1]))
      resp.headers["Content-Type"] = "image/svg+xml"
      resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
      resp.headers["Pragma"] = "no-cache"
      resp.headers["Expires"] = "0"

      return resp

   except:
      return ('', 204)

@app.route("/fumos", methods=["GET"])
@app.route("/fumos1", methods=["GET"])
@app.route("/fumos2", methods=["GET"])
@app.route("/fumos3", methods=["GET"])
@app.route("/fumos4", methods=["GET"])
@app.route("/fumos5", methods=["GET"])
@app.route("/fumos6", methods=["GET"])
def fumos():
   resp = make_response(send_file(f"./fumos/{keys.FUMOS_LIST[random.randint(0, len(keys.FUMOS_LIST)) - 1]}", mimetype="image/gif"))
   resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
   #resp.headers["Pragma"] = "no-cache"
   #resp.headers["Expires"] = "0"

   return resp

@app.route("/num")
def numgen():
   resp = make_response(render_template("num.svg", num = (random.randint(0, 9))))
   resp.headers["Content-Type"] = "image/svg+xml"
   resp.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
   resp.headers["Pragma"] = "no-cache"
   resp.headers["Expires"] = "0"

   return resp
Hindi kopo gets baguhan lang po e. Pero Salamat po
 
Pwede pobang pa. Sample kung oano gumawa nito? Nalilito po ako e.

QUESTIONS1 what is HTML[Hypertext Markup Language]
1639022195427.png
 

Attachments

Just watch more tutorials or read other people's code if you can. Generally, watching people how to do it then copying them later on is another way to learn. You can do it in no time.
Pwede pobang pagawa? Kapalan kona po mukha ko. Aaralin ko nalang po pag nakagawa napo. Kung pwede lang naman po.
 

Attachments

Back
Top