Hey, I'm new to Python, as well as this message board, and I was wondering what some of the most useful and frequently-used commands are. I've so far only learned while, if, print, input # and words, and can make some basic programs only.

I've previously had experience in TI83 programming, so I know the basics. What are the commands for random integers, repeats, different text styles, etc?

EDIT: As long as I'm at it, does anyone know any good sites where I can easily check out scripts and the like?

Recommended Answers

All 4 Replies

To find experiments with the Python random module see:

For loops and function range() are covered in:

You can search the Python snippets and this forum for other things like lists, strings, dictionaries, tuples, file handling and so on.

Different text types are the realm of GUI programming with Tkinter for instance.
Here is an example of a Tkinter GUI program that sets a text font and uses random:

# display random sentences from a list using colorful Tkinter

from Tkinter import *
import random

black  = '#000000'
blue   = '#0000FF'
red    = '#FF0000'
yellow = '#FFFF00'
lime   = '#00FF00'

sentenceList = [
'the dog is on skates', 
'the bird is on a plane', 
'the pig rides the horse',
'the snake is on rollerskates',
'the fish drives a car']

def setText():
    str1 = random.choice(sentenceList)

#create the form
form1 = Tk()

# set the form's title
form1.title('Random Text')

# create a button
push1 = Button(form1, text='Click to set new text .............', command=setText)

# configure the button's text font and foreground/background colors
push1.config(height=3, font=('times', 20, 'bold'), fg=black, bg=yellow)

# pack the button into the frame
push1.pack(expand=YES, fill=BOTH)

# start the event loop (run the program)

A good tutorial for beginners is in this online book:

Richard Gruet has very good quick-reference of Python on his home page:

The reference can be downloaded as HTML, zipped HTML or PDF file. It is in English.


Has a whole quick tutorial and it has notes on all the main topics it covers, so you can read it, or use it as a reference, i found the Tkinter section wickedly useful as a starter into gui stuff, it also has some exercises.

umm i know a few thieng for begginers like

print('WORDS GO HERE')

or if u want it to wait on somethieng u can do

import time
time.sleep(TIME TO SLEEP LIKE 10)


**hope this helps****

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.