Hello I am completely new to Python and I dont know how to prompt the user and use the information from the console in my code. So I guess the simplest example would be If I had to prompt the user for the raidus of a circle then print the area I assumed it would be something like this; Can you please tell me where I am going wrong? Sorry I know this is very basic but I can't find the answer anywhere. Thanks

area = 3.14 * r**2
r = input("Please enter the value for the radius of a circle : ")
print area

you have to assign thevariable before using it. in your case, replace the line 1 and 2 with each other.

in python 2.x use raw_input instead of input and then convert it to integer or float.

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.