User Profile

Collapse

Profile Sidebar

Collapse
Moritz B
Moritz B
Last Activity: Sep 25 '11, 06:10 AM
Joined: Aug 11 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Moritz B
    replied to data types
    hehe ok I just found out how to do it, while randomly trying out stuff.
    >type(x) returns the data type of x

    so:
    > fg=[2,5,3,"hello"]
    > print type(fg)
    would give you:
    > <type 'list'>

    ~ Mo
    See more | Go to post

    Leave a comment:


  • Moritz B
    started a topic data types

    data types

    I was wondering if there is a way of finding out what kind of data type a variable in python is storing?

    Something like:
    > print datatype(x)
    perhaps?

    Which should return string, integer, float or list etc.

    ~ Mo
    See more | Go to post

  • Moritz B
    replied to Odd list behaviour
    Ok it's all working now, thanks again. Just need to do sth about my algorithm now... going through 10 ^ 81 possibilities, of which a bazillion are totally irrelevant, by brute force just isn't quite the right thing :P
    Anyway it works if u put in like de first 76 numbers... u'd only have to wait about a minute then, till de program pops up with an answer... hehe (^ - ^')

    But back to the topic. Wouldn't one expect, just by intuition...
    See more | Go to post

    Leave a comment:


  • Moritz B
    replied to Odd list behaviour
    I'll try that. Thanks alot.

    ~Mo
    See more | Go to post

    Leave a comment:


  • Moritz B
    started a topic Odd list behaviour

    Odd list behaviour

    Hi!
    I'm coding a program that's supposed to solve Sudoku, but came accross a really odd behaviour of lists.

    comparelist is a 2D list (9 x 9) filled with integers and unsorted (and I want it to stay that way)

    >for i in range(9):
    >>> bufferlist=comp arelist[i]
    >>> bufferlist=sort er.sortiere(buf ferlist,0,len(b ufferlist)-1) # sorts a list
    >>> if bufferlist==che cklist:...
    See more | Go to post

  • Probably out of date, but anyway: the program sure is written correctly. And there are about a bazillion other ways of writing it, but de algorithm would stay de same.
    For instace:

    >from math import *
    >
    >def area_of_pizza() :
    > diameter = input("Enter the diameter of the pizza: ")
    > radius = 1.0/2.0 * diameter
    > a = pi * (radius ** 2) # ** is to the power...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...