Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newbie, looking for advices.
#1
Hello community,
I am just starting to code. I have watched all the basic tutorials and stuff, have no problems of finding specific error related questions and etc.
My question is rather simple:

I have a simple logic written with Python3 on PyCharm (which I am adding below post) and my goal is to create a webapp or something similiar, but basicly it should be reacheable via web.
It should contain simple styled window, with corresponding active buttons for answers, some pop ups and etc. When you will scan thru my code You will understand what I want.

So for this case, what should I do to make it happen? I mean, can you give me any advices where to start? I already watched sentdex youtube series about web development with django, and it is rather confusing for me, but I think it is possible.

Or I am looking for a totaly different stuff?

Thanks in advance.

CODE:

import random
print('This is the game of myths and facts')
name = input('Speicify your name: ')

myth = ['myth1','myht2', 'myht3','myht4' , 'myht5', 'myth6', 'myth 7']
fact = ['some facts 1','some facts 2', 'some facts 3','some facts 4', ' some facts 6 ', 'facts 7']
points = 0
gcount = 0
empty = []

print('Now we are going to ask you  ' + name + ', some questions and state some statements')
print('For a following answers you must type M or F')
while gcount <= 3:
    rand_mf = random.choice(myth + fact)
    if rand_mf not in empty:
        empty.append(rand_mf)
        print(rand_mf)
        print('Myth or a fact??')
        guess = input('Select an answer')
        if rand_mf in myth and guess == ('M' or 'm'):
            points +=1
            print('Correct it is a myth, you get a point, you have ' + str(points) + ' points')
        elif rand_mf in fact and guess == ('F' or 'f'):
            points +=1
            print('Correct it is a fact, you get a point, you have ' + str(points) + ' points')
        elif guess == '':
            print('Please insert your answer')
        else:
            print('WROO000ONG')
            gcount +=1
    elif points >= 10:
        break
    else:
        pass
if gcount >= 3:
    print('You lost with ' + str(points) + ' number of points')
elif points >= 10:
    print('You won with maximum 10 pts!')
print('Done')
Reply
#2
If you want to develop web application django is one possible way to go, it's very popular framework.
Another very popular option is flask and if Django looks too complicated, I would advice to look at Flask, it's very easy to get thing going. Snippsat has nice tutorial on Flask - part 1 and part2. And here are one more popular tutorial - Flask Mega Tutorial. There are also plenty of videos on youtube, just search for Flask

there are also other web frameworks = bottle, web2py, webpy, etc.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
As someone with only 4 months coding experience I can say Flask is pretty easy to use, and there is loads of people out there that can answer specific questions that you might have when it comes to troubleshooting.

Another 3 part tutorial which outlines most of what you can do on flask is:
https://scotch.io/tutorials/getting-star...oframework
https://scotch.io/tutorials/build-a-crud...k-part-one
https://scotch.io/tutorials/build-a-crud...k-part-two

Between the tutorial above, the mega tutorial which buran stated and the main flask documentation: http://flask.pocoo.org/docs/0.12/ you should be able to achieve your desired outcome.

If you want a youtube guide then sentdex and Pretty Printed both have detailed tutorials

https://pythonprogramming.net/practical-...roduction/
https://www.youtube.com/channel/UC-QDfvr.../playlists
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020