Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,208,802 members, 8,003,827 topics. Date: Friday, 15 November 2024 at 08:10 PM

Practical Introduction To Python Web Programming - Programming (3) - Nairaland

Nairaland Forum / Science/Technology / Programming / Practical Introduction To Python Web Programming (6629 Views)

Web Programming Tutorial In Python. / Sumit Raj Discusses Python Web Development, Chatbot, Natural Language Processing / Learn Python- Introduction To Programming (2) (3) (4)

(1) (2) (3) (Reply) (Go Down)

Re: Practical Introduction To Python Web Programming by sinkhole: 10:26am On Jan 10, 2016
basbone:
Before we proceed, questions are accepted regarding the few steps we've covered so far......
I am finding it hard to get it work from this place! I am using chrome/yandex browser.
on typing "web2py -a '123' -p 8081" I kept getting a "syntax error"
Re: Practical Introduction To Python Web Programming by kachnov(m): 12:45pm On Jan 12, 2016
basbone:
Looping:

While loop:

in while loop, we must first initialize a starting point, you can't just meet your friend and tell him, "while i ride to the road, clap for me." thats illogical! What are you riding, where are you starting your ride Thats one lovely thing about programming, it makes you think sensibly! So before you are riding, you must start from somewhere......

So i will say,

my_start = 1
road = 10
while my_start < road:
print "i am clapping for you"

mind you, it will run to infinity......

Hi dude,sent you a pm.
You can teach online the full course on our site for free.(paid/free )
Re: Practical Introduction To Python Web Programming by Nobody: 7:18pm On Feb 03, 2016
sinkhole:
I am finding it hard to get it work from this place! I am using chrome/yandex browser.
on typing "web2py -a '123' -p 8081" I kept getting a "syntax error"

wow....its been long. Sorry for replying late. If you downloaded web2py for windows, it should work else if you downloaded the source file, i.e web2py.py then you must run it via python, i.e

python web2py.py -a '123' -p 8081

make sure to give spaces between the command line codes......
Re: Practical Introduction To Python Web Programming by sinkhole: 4:05am On Feb 05, 2016
basbone:


wow....its been long. Sorry for replying late. If you downloaded web2py for windows, it should work else if you downloaded the source file, i.e web2py.py then you must run it via python, i.e

python web2py.py -a '123' -p 8081

make sure to give spaces between the command line codes......
Thanks, I finally got it to work, but I had to do some tweaking beyond the tutorial grin I had to click on web2py application, changed the server port to 8081 and start the server!
For those asking for e-book, I have an e-book by Massimo DiPierro, but it is about 4.1MB and NL only allows 250kB, so I do not know how to get it across for now cry
Re: Practical Introduction To Python Web Programming by Nobody: 1:54pm On Feb 05, 2016
sinkhole:
Thanks, I finally got it to work, but I had to do some tweaking beyond the tutorial grin I had to click on web2py application, changed the server port to 8081 and start the server!
For those asking for e-book, I have an e-book by Massimo DiPierro, but it is about 4.1MB and NL only allows 250kB, so I do not know how to get it across for now cry

welcome, i used the command line parameters so that users can get themselves acquinted with cl scripts especially when switching to other frameworks like django....

So how did you see the web-based IDE/interface? Any apps under your sleeves?
Re: Practical Introduction To Python Web Programming by sinkhole: 7:51pm On Feb 05, 2016
.
Re: Practical Introduction To Python Web Programming by WafiJoe(m): 8:42pm On Feb 05, 2016
Guys please I need help fast. What is wrong with this code:

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
new_word = word + first + pyg
new_word = [1 : len(new_word)] #What is wrong with this line?
print original
else:
print 'empty'
Re: Practical Introduction To Python Web Programming by umaryusuf(m): 12:19pm On Feb 06, 2016
WafiJoe:
Guys please I need help fast. What is wrong with this code:

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
new_word = word + first + pyg
new_word = [1 : len(new_word)] #What is wrong with this line?
print original
else:
print 'empty'



Maybe u forgot to add name of the list u want to filter, like so: new_word = word[1 : len(new_word)]
Re: Practical Introduction To Python Web Programming by WafiJoe(m): 1:57pm On Feb 06, 2016
umaryusuf:




Maybe u forgot to add name of the list u want to filter, like so: new_word = word[1 : len(new_word)]

Yeah yeah, thanks for answering. I got that one solved yesterday. Now I need response for this problem, and it is urgent. Here is the code below:

prices = {"banana":4, "apple":2, "orange":1.5, "pear":3}
stock = {"banana":6, "apple":0, "orange":32, "pear":15}

for fruit in prices:
print fruit
print "price: %s " % prices[fruit]
print "stock: %s " % stock[fruit]

Please tell me, what is wrong with the above code?
Re: Practical Introduction To Python Web Programming by WafiJoe(m): 2:08pm On Feb 06, 2016
WafiJoe:


Yeah yeah, thanks for answering. I got that one solved yesterday. Now I need response for this problem, and it is urgent. Here is the code below:

prices = {"banana":4, "apple":2, "orange":1.5, "pear":3}
stock = {"banana":6, "apple":0, "orange":32, "pear":15}

for fruit in prices:
print fruit
print "price: %s " % prices[fruit]
print "stock: %s " % stock[fruit]

Please tell me, what is wrong with the above code?

Got it. There shouldn't be space before the "
Re: Practical Introduction To Python Web Programming by MrReloaded(m): 9:09am On Feb 07, 2016
My pycharm expired yesterday, did any1 has a license key for it
Re: Practical Introduction To Python Web Programming by Nobody: 6:00pm On Feb 09, 2016
WafiJoe:


Yeah yeah, thanks for answering. I got that one solved yesterday. Now I need response for this problem, and it is urgent. Here is the code below:

prices = {"banana":4, "apple":2, "orange":1.5, "pear":3}
stock = {"banana":6, "apple":0, "orange":32, "pear":15}


for fruit in prices:
print fruit
print "price: %s " % prices[fruit]
print "stock: %s " % stock[fruit]

Please tell me, what is wrong with the above code?

take note of the bolded. It is a good programming practice to use numbers as keys when accessing a python dictionary, such as:

stock = {4:'banana', 6:'apples', 5:'mango'}
Re: Practical Introduction To Python Web Programming by JigsawKillah(m): 6:04pm On Feb 09, 2016
basbone:


take note of the bolded. It is a good programming practice to use numbers as keys when accessing a python dictionary, such as:

stock = {4:'banana', 6:'apples', 5:'mango'}


Boss, continue na
Re: Practical Introduction To Python Web Programming by Nobody: 6:10pm On Feb 09, 2016
JigsawKillah:


Boss, continue na
alright.....please pardon me for the delay.
Re: Practical Introduction To Python Web Programming by JigsawKillah(m): 6:14pm On Feb 09, 2016
basbone:


alright.....please pardon me for the delay.


OK
I'm anticipating your next update
Re: Practical Introduction To Python Web Programming by Nobody: 6:41pm On Feb 09, 2016
Introduction to functions

functions makes our programs to be modular in nature, i.e, instead writing long list of python statements within our main program, we could break them into modules called functions. This ensures readability, consistency and portability of our code. A typical python function starts with:

def your_function_name() :

def means function definition, then followed by the name of your function, and a colon ( : )
For example,



def hello():
for i in range(1, 13):
print "hello python!"

def main():
hello()

main()



this will print "hello python!" twelve times.

1 Like

Re: Practical Introduction To Python Web Programming by Nobody: 6:51pm On Feb 09, 2016
In some codes, for those of us that loves reading codes from opensource projects, we often see something like this:



def hello():
print "blah blah"

if __name__ == '__main__':
hello()



this simply means that if the program will start with a main function, it should be the hello() function.

1 Like

Re: Practical Introduction To Python Web Programming by Nobody: 7:15pm On Feb 09, 2016
Dealing with *args and **kwargs

in python functions, we often deal with *args (i.e arguments) and **kwargs (i.e keyword arguments)
for example:


def login(user_name, pass, *args, **kwargs):


my simple explanation to this is that,

*args is used to represent a tuple within the function

while

**kwargs is used to represent a python dictionary within the function.

So, if you know how to define a tuple and dictionary, you can specify them within a function using the *args and **kwargs respectively......


This brings us to the END of our Python introduction. Other imperative resources to look into are:

The Python Documentation from www.python.org

www.pythontutor.com

You can also check out www.python.org/moin/FrontPage

Finally, always remember that www.google.com.ng is your friend.

Now, over to more funnier things........web programming with web2py

1 Like

Re: Practical Introduction To Python Web Programming by JigsawKillah(m): 7:58pm On Feb 11, 2016
basbone:


Finally, always remember that www.google.com.ng is your friend.

Now, over to more funnier things........web programming with web2py


Funny? My guts feelings says it isn't LOL
Ride on Boss

(1) (2) (3) (Reply)

My C++ Voting System Program Algorithm / MY JOURNEY WITH PYTHON!!! / For Those Willing To Be Data Analyst, Machine Learning Guru

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 40
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.