write a program code thathas two functions: first() and second(). Function first() should print the string "in function first()" and then call function second()> functions second() should print the string "in function second()". in the global scope, you should call function first.

C'mon, show a little effort. It's not hard, I promise.

This page might help.

thanks that actually help alot im just a little lost on how you would use global scope to call function first() here my code

def first(my_string):
    print "In function", first('first()')

def second(my_string):
    return my_string
print "In function", second('second()')

To call a function you simply type its name and a pair of parenthesis. Between the parenthesis is where you'll supply any parameters the function takes.

Replace line 6 with: first("any text here") Consider redoing your code a little bit. It's a little confusing and it will not do what you want just yet.

To call a function you simply type its name and a pair of parenthesis. Between the parenthesis is where you'll supply any parameters the function takes.

Replace line 6 with: first("any text here") Consider redoing your code a little bit. It's a little confusing and it will not do what you want just yet.

okay i get how to call a function (which the function i got to call is function 2) but how could i use global scope to call function 1

global scope lines are top-level lines outside the functions without indentation like line 6 in your code.

global scope lines are top-level lines outside the functions without indentation like line 6 in your code.

what does the global scope code look like? do you have like a example or something to show me?

global scope lines are top-level lines outside the functions without indentation like line 6 in your code.

def first(my_string):
    print "In function", first('first()')

def second(my_string):
    return my_string
first("any text here") #call to function 'first' in global scope
def first(my_string):
    print "In function", first('first()')

def second(my_string):
    return my_string
first("any text here") #call to function 'first' in global scope

this is my new code that i think i fixed

def first(my_string):
    print "in function first()"


def second(my_string):
    print "In function second()"
second("any text here")
first ("any text here")

using this code which part of the code uses global scope to call function first()
then how do i call function second()


this is what i am trying to do
write a program that has two functions: first() and second(). function first() should print the string "in function first()" and then call function Second() function second() should print the string in function second(). in the global scope, you should call function first()

Read your directions. The function 'first' should print "in function first()" and then it calls 'second'.

Your code right now calls second, and then first.

You also don't need the variable 'my_string' or the "any text here" because you don't use it. I only used that as an example.

Read your directions. The function 'first' should print "in function first()" and then it calls 'second'.

Your code right now calls second, and then first.

You also don't need the variable 'my_string' or the "any text here" because you don't use it. I only used that as an example.

thanks for your help
i like haveing the variables "my string" and "any text here" just helps me fills in the spaces okay i did some fixing i think so

def first(my_string):
    print "in function first()"


def second(my_string):
    print "In function second()"
    return second
    
second("any text here")

You got return value not used at line 7, input parameters not used...

Sorry, but you can do better!

You don't need to fill the spaces but if you want those unused variables, oh well.

You're still calling the function 'second' before you call 'first'.

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.