Function compiling online is not showing any output

A forum for general discussion of the Python programming language.

Function compiling online is not showing any output

Postby daniel_12 » Mon Jul 01, 2013 6:50 am

Hi All,

I'm new to python programming, I'm using compileonline.com to compile and execute my program.

I tried compiling the program below,
def hello():
print "Hello"
print "Computers are Fun"

It is not showing any error or output. I am not able to execute any program with functions but if I just give the print statement I can see the output. Kindly let me know the mistake that I am doing and how to resolve it.

Regards
Daniel
daniel_12
 
Posts: 1
Joined: Mon Jul 01, 2013 6:44 am

Re: Function compiling online is not showing any output

Postby metulburr » Mon Jul 01, 2013 6:59 am

i am guessing you defined the function but never called it

Code: Select all
def hello():
  print "Hello"
  print "Computers are Fun"
 
hello()

the last line here is calling the function
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1103
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 2 guests