PDA

View Full Version : a little tutorial for the newbies



bribaetz
October 28th, 2007, 01:34 AM
my python tutorial (http://ubuntuforums.org/showthread.php?t=593887)
ok to all newbie programmers and i am not saying that i am not one
this tutorial is to help you get started.

getting started
choosing a language
finding a good tutorial
putting yourself in the community

getting started
ok getting started it easy all you need is a compiler and a idea of what language you want.
you might consider getting the geany ide it auto indents and has about 20 different language it can be an ide for and all you have to do is get a compiler.
also you want to get to know Ubuntu and the terminal there are plenty of tutorials for those around.
picking a language
you will want to find a good language
here are some good ones for beginners
python
ruby
perl
pascal (i know it is old but good anyway in my opinion)
C++ (its not all that hard in my expieriance)

these are all good
finding a tutorial
tutorial for terminal (http://ubuntuforums.org/showthread.php?p=990636) and just search around for a tutorial
getting involved
just put your self in to the community talk to others on ubuntu & linux forums.

LaRoza
October 28th, 2007, 01:47 AM
This wiki is good for beginners, a lot of good resources and tutorials http://learnpython.pbwiki.com/HowToStart

slavik
October 28th, 2007, 01:48 AM
you put in C++ but not C?

bribaetz
October 28th, 2007, 06:07 PM
im know a lot about c like its really low level and hard for a first language.

LaRoza
October 28th, 2007, 06:50 PM
http://ubuntuforums.org/showthread.php?t=528483

The OP's opinion of C

CptPicard
October 28th, 2007, 07:03 PM
i wrote this thread so new programmers would not end up where i did

Where did you end up? Why? What did you learn that you are applying here to make a better tutorial? :) Why are the other tutorials bad?

Anyway, welcome back man, I kinda missed you... kinda.. :)

Perfect Storm
October 28th, 2007, 07:18 PM
Closed due to some complaints. Will be re-open when the investigation is done.

Perfect Storm
October 28th, 2007, 07:54 PM
Re-open.

bribaetz
October 28th, 2007, 09:00 PM
yay my first functional program in python XD
can i ave opinions

loop = 0
choice = 0
while loop == 0:
##pycalc
##setting a vairiable for the loop
a = input("input a number:")
sign = raw_input("input +, /, *, -:")
b = input("input a number:")

if sign == "+":
choice = 1
if sign == "-":
choice = 2
if sign == "*":
choice = 3
if sign == "/":
choice = 4
if sign == "e":
choice = 5
if choice == 1:
c = a + b
print a, "+", b, "=", c

if choice == 2:
c = a - b
print a , "-", b, "=", c

if choice == 3:
c = a * b
print a, "*", b, "=", c

if choice == 4:
c = a / b
print a, "/", b, "=", c
if choice == 5:
loop = 0

bribaetz
October 28th, 2007, 09:33 PM
is that really al everyone has for this thread

CptPicard
October 28th, 2007, 10:23 PM
What is your point of using the "choice" variable? It's completely redundant. Just do the math already in the branch where you recognize the mathematical operation the user wants to perform by entering "+", "-", etc...

bribaetz
October 28th, 2007, 10:28 PM
i guess i get what your saying i am really inexperienced at this but none the less it works but not well i guess

CptPicard
October 28th, 2007, 10:30 PM
I suggest you go back to reading tutorials before writing them ;)

bribaetz
October 28th, 2007, 10:33 PM
your right i thought it might be able to help but it probably confused anyone who tried reading it caused by my confusion

ghostdog74
October 29th, 2007, 12:38 AM
yay my first functional program in python XD
can i ave opinions

loop = 0
......

if sign == "+":
choice = 1
if sign == "-":
choice = 2
if sign == "*":
choice = 3
if sign == "/":
choice = 4
if sign == "e":
choice = 5
if choice == 1:
c = a + b
print a, "+", b, "=", c

if choice == 2:
c = a - b
print a , "-", b, "=", c

if choice == 3:
c = a * b
print a, "*", b, "=", c

if choice == 4:
c = a / b
print a, "/", b, "=", c
if choice == 5:
loop = 0

you can use dictionaries for all these if/elses


signs = { "+" : 4 , "-" : blah , blah ....}
choices = { }


you can use a while True (1) loop instead of specifying a loop flag.



while 1:
... do stuff
if choice in [ "q","Q"]; break # or exit
....

bribaetz
October 29th, 2007, 12:58 AM
i haven't got that far yet