-3

every time i press enter key shows me

[]
none 

i do not know why and i want to write number 6 instead of passing it as a parameter stackoverflow do not accept the question until i write anything but i write all what i know i use pytharm by the way i want the output something like that

6
baraclona
madrid 
spain
africa
USA
UAE

code

def OutputMostPopularDestination( count):
    test = input(count)
    inputs =[]
    for i in test:
        string_input = input()
        inputs.append(string_input)

    print(inputs)

print(OutputMostPopularDestination(6))
Bav
  • 139
  • 2
  • 3
  • 14
  • 1
    There are several things wrong with your program. Please read and follow along with the entire [Python Tutorial](https://docs.python.org/2/tutorial/). After you finish, you will be able to write this program without error. – Robᵩ May 21 '16 at 18:43

1 Answers1

1

You have a number of problems in your program. Here are some of them:

  • You pass in count, but you use test in your loop
  • input() returns a str, but you use it as an int. A conversion is required.
  • The typical counting for loop is like for i in range(count). A call to range() is required.
  • Functions with no return statement implicitly return None. A return inputs is required.

Try this:

def OutputMostPopularDestination( ):
    test = int(input("How many lines?"))
    inputs =[]
    for i in range(test):
        string_input = input()
        inputs.append(string_input)

    return inputs

print(OutputMostPopularDestination())
Robᵩ
  • 163,533
  • 20
  • 239
  • 308