Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,003 members, 7,817,968 topics. Date: Sunday, 05 May 2024 at 12:26 AM

Questions A Beginner Python Programmer Have - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Questions A Beginner Python Programmer Have (2971 Views)

I Want To Hire A Beginner Who Is Willing To Learn New Skills / Any Female Python Programmer Here?? / Should A Beginner Learn 2 Programming Languages At Once? (2) (3) (4)

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

Questions A Beginner Python Programmer Have by kennikazi(m): 6:22pm On Oct 16, 2013
To help package this section and avoid clustering, I think there should be a FAQ thread for each and every programming language so that beginner programmers can ask questions and get meaningful answers to there questions.

That aside, I do have some questions I would like to have simplified/meaningful answers to:

1.) What exactly is the diff btw class variables and instance variables? Are they variables of classes and objects resp?? And how are they used in a python program??

2.) How can I develop a web application in python? Do I need to buy VPS hosting to host the web app?? Can I host the web app on my PC?? If yes, how can that be done?

3.) How exactly does a database function?? And how can it be controlled with my web app??

4.) How exactly is an API used? How can I connect my app/software to a web service?? Is it done with this "API"??

Biko nu, dnt discourage upcoming programmers like me by not answering, or telling me to "google it". I came here for help, xo pweez help moi....peacesmiley
Re: Questions A Beginner Python Programmer Have by wisemania(m): 3:15am On Oct 17, 2013
Broda no offence,from ur wryt up it appears uve not started studying python already,question number 1 is what u shuld already be enlightened about during d introduction to all programming languages...am not a pythonist naida am i a pythoninja or rada a pythonian ,but am sure dat AJIBEL(naija's greatest pythoninja/physicist) with d lites of others will be wiling 2 spoonfeed u wellemly ....ajibel oya prove ur WORTH!...b4 i........
Re: Questions A Beginner Python Programmer Have by Creatrixity(m): 7:15am On Oct 17, 2013
1.Instance variables are readily accessible by all objects and methods while class variables are protected.
To make a class variable visible you would have to use the global keyword.
I will think up an example and answer question 2 when i get back on my pc.
Re: Questions A Beginner Python Programmer Have by wisemania(m): 2:11pm On Oct 17, 2013
What is it wit d hidden posts....
Re: Questions A Beginner Python Programmer Have by Creatrixity(m): 3:52pm On Oct 17, 2013
To develop a web application in python you could:
*Write a cgi script in python using the cgi lib and upload it to a webserver .
*Write up a framework in python wsgi(lol!) or
*Utilize any of the many frameworks.
You could use:
*django
*web2py
*cherrypy
*pylons
*turbogears
*pyramid
*tornado
*flask
The list is limitless!
Yep,you would have to buy a vps and spend an eternity tweaking config files or you could get cloud hosting from PAAS providers.
Options are:
*Amazon's Heroku
*Redhat's Openshift
*Google App engine (GAE)
*Microsoft azure
*Stackatto
*dotcloud
*rackspace
You choose!

1 Like

Re: Questions A Beginner Python Programmer Have by Nobody: 4:31pm On Oct 17, 2013
Re: Questions A Beginner Python Programmer Have by Creatrixity(m): 7:09pm On Oct 17, 2013
decode: Am a beginner python programmer, am having problem with the ''input" function. Whenever I try to run a code which include, say
X=input("enter a number"wink
print (" 5 + X = ", 5 + X)
it says - type error can't multiply obj with type 'float'; or something like that. I don't understand what is goingon
It should be
X=input('enter num')
try:
x=int(x)
except Exception as e:
print e.message
a=x+5
print('5 + 5=%d'%a)
Does some error handling..

1 Like

Re: Questions A Beginner Python Programmer Have by kennikazi(m): 9:33pm On Oct 17, 2013
decode: Am a beginner python programmer, am having problem with the ''input" function. Whenever I try to run a code which include, say
X=input("enter a number"wink
print (" 5 + X = ", 5 + X)
it says - type error can't multiply obj with type 'float'; or something like that. I don't understand what is goingon
u cud convert ur input to an integer like
x=int(input(enter a number-))
create a variable for the other number like,
a=5
then do ur printing,
print ("5 + x", a + x)
i think this wud work....

1 Like

Re: Questions A Beginner Python Programmer Have by kennikazi(m): 9:46pm On Oct 17, 2013
Tnx creativixy for answering som questions,
My database and API questions are stil unanswered.
In addition to my databse question, when using the Python DB-API, does it mean that i wud not query my database with SQL again?? First of all, how can I create a database with SQLite, and is it possible to create sub-tables, that is a table under anoda table(or somtn like that)??

And finally for today, how doz a web application communicate with the client-side?? What is AJAX and JSON, and how are they involved with server side communication
Re: Questions A Beginner Python Programmer Have by Javanian: 9:08am On Oct 18, 2013
kennikazi: Tnx creativixy for answering som questions,
My database and API questions are stil unanswered.
In addition to my databse question, when using the Python DB-API, does it mean that i wud not query my database with SQL again?? First of all, how can I create a database with SQLite, and is it possible to create sub-tables, that is a table under anoda table(or somtn like that)??

And finally for today, how doz a web application communicate with the client-side?? What is AJAX and JSON, and how are they involved with server side communication

Please you are rushing things, take it easy grin

AJAX is the art of exchanging data with a server, and updating parts of a web page - without reloading the whole page. If you visit facebook on your P.C you would notice that your timeline gets updated without reloading the page on your browser.

JSON is a lightweight data-interchange format. JSON is quite similar to xml. They are both used for exchanging data. AJAX could use JSON/XML to interchange data with your server.

1 Like

Re: Questions A Beginner Python Programmer Have by Javanian: 9:14am On Oct 18, 2013
kennikazi: To help package this section and avoid clustering, I think there should be a FAQ thread for each and every programming language so that beginner programmers can ask questions and get meaningful answers to there questions.

That aside, I do have some questions I would like to have simplified/meaningful answers to:

Can I host the web app on my PC?? If yes, how can that be done?


Yes, but your P.c would have to be powered 24/7 and have steady access to the internet. But you are better of using a commercial hosting plan.


3.) How exactly does a database function?? And how can it be controlled with my web app??

A database is use for storing data. You control it in your web app with a server side language (like python) and probably SQL.


4.) How exactly is an API used? How can I connect my app/software to a web service?? Is it done with this "API"??

Yes an API can be used to connect an app/software to a web service.

Curiosity is good, but just relax, it seems you want to learn every thing at once. Just take it step by step.
Re: Questions A Beginner Python Programmer Have by Creatrixity(m): 10:28am On Oct 18, 2013
Excellent answers javanian.
To use python to connect to a database,You must install the appropriate python module for that database.
MYSQLDb for MYSQL
psycopg2 for postgresql.etc..
Python comes with the sqlite3 module.
To retrieve a list of books from a db we could do this:
import MySQLdb
print "Content-type=text/html"
print """
<html>
<head>
<title>
</title>
</head>
<body>
<p>List of all books</p>
"""
connection=MySQLdb.connect(user="me",passwd="letMeIn",db="mydb"wink
cursor=connection.cursor()
#This is where the sql execution goes
cursor.execute("SELECT * FROM ORDER BY DATE desc"wink
for row in cursor.fetchall():
print "<li>%s</li>"%row[0]
#end html here
connection.close()
If you are interested in python REST services,read up on the tastypie library.
Re: Questions A Beginner Python Programmer Have by kennikazi(m): 12:26pm On Oct 18, 2013
Tnx alot @Javanian....uv settled my mind on a lot of aspects.

Now, my plan is to create a web application and I am told to master html/css(complete), javascript(in progress), python(in progress), django(confused), and database management(more confused).

Please is there any "simple" ebook you could refer me to that would further accustom me to the this database ish??
Re: Questions A Beginner Python Programmer Have by Javanian: 1:50pm On Oct 18, 2013
kennikazi: Tnx alot @Javanian....uv settled my mind on a lot of aspects.

Now, my plan is to create a web application and I am told to master html/css(complete), javascript(in progress), python(in progress), django(confused), and database management(more confused).

Please is there any "simple" ebook you could refer me to that would further accustom me to the this database ish??

Sorry to say this but Google is your friend. They are different types of databases out there but mysql is the most common and it is free. Try and learn python first, create some simple apps with it before talking of databases. like I said, just relax you would get there. Also, for mysql and most other relational databases, you would need knowledge of SQL. So you can go to w3schools.com and learn SQL first. The basics of SQL are quite simple. After that you can search on google for any tutorials on mysql. I beleive Django is a framework, frameworks are basically tools that make life easier for you. But it would make sense to master the basic python syntax first before using a framework. I hope this helps. Feel free to ask more questions.
Re: Questions A Beginner Python Programmer Have by Nobody: 2:06pm On Oct 18, 2013
Javanian:

Yes, but your P.c would have to be powered 24/7 and have steady access to the internet. But you are better of using a commercial hosting plan.



A database is use for storing data. You control it in your web app with a server side language (like python) and probably SQL.



Yes an API can be used to connect an app/software to a web service.

Curiosity is good, but just relax, it seems you want to learn every thing at once. Just take it step by step.

Touchè
Re: Questions A Beginner Python Programmer Have by Nobody: 2:17pm On Oct 18, 2013
OP, I can hazard that by "beginner python programmer" u mean u are someone who has no prior programming experience whatsoever. But the kind of questions u are asking seems a little more apt for someone who has programming experience but no python language experience.
I would advice to to take @Javanian's advice. Be well grounded the fundamentals of programming with Python first. Because if u dont, even the solution people like @Creaxitity is giving u will still look like greek to u. And even if u manage to implement them, u wont have an indepth knowledge of how it works.
If u can get the fundamentals of python, everything else will be easy. Most of ur help will come from documentations. U will be able to read documentations on python modules and figure out how to use them easily. And u will understand things ur own way. And then any app u want to build in python will just require a little less effort on ur part.
Baby steps bro, baby steps. smiley

2 Likes

Re: Questions A Beginner Python Programmer Have by wisemania(m): 2:48pm On Oct 18, 2013
^^well said boss...
Dats wt av been trying 2 tell him...he tinks lenin al @ once is d bst...u tink say 2 len js and python 2geda na EWA-AGONYI abi,js alone is takin my bloody tym to grasp yet am stil battling wit it,i was formaly in2 c++ but had 2 leav it 4 webdesign...my guy its beta u free python 4now and face html,css and js squearly b4 python and etc...coz if u continue in dat route of urs,den ull end up confusing ya sef....*na my 2cents bdat*
by d way wr is ajibel ?
Re: Questions A Beginner Python Programmer Have by kennikazi(m): 5:40pm On Oct 18, 2013
ok...tank peepz for your fatherly advises, i'll try my best and take the learning process as slow as possible. why i got tired of google was because, the results they gave me was overwhelming and sent moi into confusion sad
all is well, i have no bothering questions this evening and would still post questions on this thread when i get confused.
biko thanks @everyone once again grin

p.s: at what level can someone say he has learnt much in a programming language? i have finished swaroop's ebook on byte of python and it still seems like i am still starting??
Re: Questions A Beginner Python Programmer Have by Javanian: 6:05pm On Oct 18, 2013
kennikazi: ok...tank peepz for your fatherly advises, i'll try my best and take the learning process as slow as possible. why i got tired of google was because, the results they gave me was overwhelming and sent moi into confusion sad
all is well, i have no bothering questions this evening and would still post questions on this thread when i get confused.
biko thanks @everyone once again grin

p.s: at what level can someone say he has learnt much in a programming language? i have finished swaroop's ebook on byte of python and it still seems like i am still starting??

You would always feel you are starting until you have built something with it to appreciate what you have learnt. Build something, No matter how small and trivial, something that interest you cheesy
Re: Questions A Beginner Python Programmer Have by kennikazi(m): 7:30pm On Oct 18, 2013
Javanian:

You would always feel you are starting until you have built something with it to appreciate what you have learnt. Build something, No matter how small and trivial, something that interest you cheesy
yah i knw, that's why i wnted to build a web app based on python. But ayav seen that it is not a small thing. Anywayz shaa, ayam makin progress...
Re: Questions A Beginner Python Programmer Have by wisemania(m): 7:51pm On Oct 18, 2013
kennikazi:
yah i knw, that's why i wnted to build a web app based on python. But ayav seen that it is not a small thing. Anywayz shaa, ayam makin progress...
du well to paste ur codes here when ure done wif d webapps....we'll appreciate it wellemly
Re: Questions A Beginner Python Programmer Have by Nobody: 1:32am On Oct 19, 2013
C.H. Swaroop's book is good. I started Python with it too. But it is too short and it doesnt cover a lot of areas well. But I will advice u get this book:
Think Python: how to think like a computer scientist.
That is one great book. Once u are able to read it, follow the examples and do some of the programming assignments, then u are good to go. Pay special heed to the definitions and tips because that book is made to get u grounded in computer science using python as a programming tool.
After that, read one or two more books that are over 300-500 pages while u are working on different projects. For instance, if u are writing a program that reads and writes files and hit a stone wall, u should be able to get a book that treats that area of python in-depth and learn from it.
The reason I advise u read more than one book is because different authours have different strenghts and explanation styles. U can never tell which of the authors will give u d clearest explanations on a particular area.
Re: Questions A Beginner Python Programmer Have by Nobody: 10:31pm On Oct 19, 2013
I see a few of my guys are here. I've been hoping to move from the religion section to some other section. The gaming section has more cobwebs than threads. This zone looks interesting, God arguments don dey taya me. grin

Shallat to Creatixity and Phenomenom.

@javanian: how far ur app?

2 Likes

Re: Questions A Beginner Python Programmer Have by Javanian: 10:40pm On Oct 19, 2013
aManFromMars: I see a few of my guys are here. I've been hoping to move from the religion section to some other section. The gaming section has more cobwebs than threads. This zone looks interesting, God arguments don dey taya me. grin

ROFLMAO! Please!!! don't leave, you are one of the reasons i visit that section 5 times a day.

Shallat to Creatixity and Phenomenom.


@javanian: how far ur app?

Apple and their wahala rejected it because of some flimsy excuse, asking me to redesign my U.I. I couldn't go through the stress of doing that and bothering you all over again so i abandoned it, what annoys me more is the $100 i spent getting the developers account. But the Android version is set to launch next week.
Re: Questions A Beginner Python Programmer Have by Creatrixity(m): 10:46pm On Oct 19, 2013
oga manfrommars(bros abeg summarise that name to martian2..e too long unlike your former moniker,but see me whey dey talk nobody don write my own well) welcome to the new skeptics section.
I would love to see some Indian programming here..
Good to see you
Re: Questions A Beginner Python Programmer Have by Creatrixity(m): 11:03pm On Oct 19, 2013
Javanian:

ROFLMAO! Please!!! don't leave, you are one of the reasons i visit that section 5 times a day.

Shallat to Creatixity and Phenomenom.



Apple and their wahala rejected it because of some flimsy excuse, asking me to redesign my U.I. I couldn't go through the stress of doing that and bothering you all over again so i abandoned it, what annoys me more is the $100 i spent getting the developers account. But the Android version is set to launch next week.
Wow!Apple is very stringent about issues like that.
Apparently they expect you to make your app's design to be consistent with ios7 design language(flat opposed to skeumorphic).
Well,when i focus on mobile app development,I will definitely go with android.
Please announce your app's release here,I would love to check it out!
Re: Questions A Beginner Python Programmer Have by Javanian: 11:06pm On Oct 19, 2013
Creatrixity:
Wow!Apple is very stringent about issues like that.
Apparently they expect you to make your app's design to be consistent with ios7 design language(flat opposed to skeumorphic).
Well,when i focus on mobile app development,I will definitely go with android.
Please announce your app's release here,I would love to check it out!

They are really strict, they can reject your app for the silliest of reasons. I would notify every one when the app is set to launch.
Re: Questions A Beginner Python Programmer Have by Ajibel(m): 12:06am On Oct 20, 2013
Wheew,, a friend actually pasted this thread link to my FB inbox say person need help. Sorry buh i see you've gotten responses already, i was just lurking around on other NL sections to know waddup smiley

# You cant claim to be good in python after just finishing one or two tutorials. You've got to read more (i've got about 20 and i've finished mur than half)
# Go online, tackle puzzles n challenges buh dont get carried away. Look thro' other pythonists codes to learn more from.
# Write some programs of your own. I wrote for e.g: contact book, sales record, students mark record etc...
# If u are going into web, try Django (am on it) buh na die oo.
# There are lots of ebooks out there, never get tired of google else people could get tired of answering ya. (I've ignored like 5guys who were always on my neck asking questions on their exercises without research'n
# Lastly, u could modify and give this thread a title that would let the beginners/intermediates ask questions here !!
Re: Questions A Beginner Python Programmer Have by Nobody: 7:25am On Oct 20, 2013
Creatrixity:
Wow!Apple is very stringent about issues like that.
Apparently they expect you to make your app's design to be consistent with ios7 design language(flat opposed to skeumorphic).
Well,when i focus on mobile app development,I will definitely go with android.
Please announce your app's release here,I would love to check it out!

Android is the future bro.
Open source is the new religion.
If not for my laziness or unwillingness, I would have started android programming fully but I am loath to learn Java as a programming language. I was planning to use Python with SL4A before. But it was kind of quirky. So now I think I should learn Java. That will be my first target next year. And Jython will come in handy for me afterwards.
Re: Questions A Beginner Python Programmer Have by Nobody: 7:29am On Oct 20, 2013
aManFromMars: I see a few of my guys are here. I've been hoping to move from the religion section to some other section. The gaming section has more cobwebs than threads. This zone looks interesting, God arguments don dey taya me. grin

Shallat to Creatixity and Phenomenom.

@javanian: how far ur app?


Shallat to u too bro. smiley

(1) (2) (Reply)

Gradle Problem In Android Studio / Learn How To Build A Realtime Chat Application With Django, Rabbitmq And Vue.js / What Really Can I Do In The Dark Web With The Aid Of Tor Brwser?

(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. 65
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.