String and console


#1

This is my code, I can't seem to figure it out:

"""Declare and assign your variable on line 4,
then call your method on line 5!"""

pi= "3.14"
print str(pi)


#2

You don't need your number in a string as the str() method will cause it to be put into a string after you print it.


#3

So does it need to be like:

pi= 3.14

or am I still messing up? I still kinda don't understand.


#4

Should it be:

pi=3.14
print str(pi)

instead of:

pi= "3.14"
print str(pi)


#5

This should be correct


#6

It still is not working, do I reset the exercise or completely close out the tab. I'm typing that in and this pops up.

Oops, try again. Did you create a variable called pi?

This is my code:

"""Declare and assign your variable on line 4,
then call your method on line 5!"""

pi=3.14
print str(pi)
Do I group the print with the pi=3.14?


#7

Go ahead and close out your browser and get on a fresh one then reset the code and copy and paste this one in. That should avoid any technical problem your having...

"""Declare and assign your variable on line 4,
then call your method on line 5!"""
pi = 3.14

print str(pi)

#8

Oh I figured it out, thanks of the help!:grin:


#9

Good! Glad to have helped! Hopefully your other codes go smoother :thumbsup:


#10

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.