-3

I need to create a function generateString(char, val) that returns a string with val number of char characters concatenated together. I'm new to coding and am having some trouble with defining my own functions

I have tried returning a number of different return methods but can't figure this one out.

import sys
character= sys.argv[1]
count= int(sys.argv[2])

def generateString(char, val):

When I try to output the results I'm getting nothing.

  • 1
    Can you show what you already have tried? – StefanG Aug 04 '19 at 11:46
  • return val * char/ return (character, value) – jacob sampson Aug 04 '19 at 11:49
  • The scripting course I am taking doesn't explain what we are supposed to do very well. They show us very basic examples in the reading and then the challenges stray from the book. – jacob sampson Aug 04 '19 at 11:51
  • 1
    You are probably looking for `return char * val` – Andrej Kesely Aug 04 '19 at 12:38
  • 1
    Please use the [edit link](https://stackoverflow.com/posts/57346180/edit) under the question to update your post, like adding the codes you tried. It can be hard to read codes in comments, and adding your codes (even if it does not work) can give us some idea of what you want to do. – Gino Mempin Aug 04 '19 at 15:22
  • Possible duplicate of [In Python, how do I create a string of n characters in one line of code?](https://stackoverflow.com/questions/1424005/in-python-how-do-i-create-a-string-of-n-characters-in-one-line-of-code) – Gino Mempin Aug 04 '19 at 15:28

1 Answers1

-1

Sorry if my english is not that good, but i think it was this you wanted

# Python program to illustrate 
# enumerate function 
l1 = ["eat","sleep","repeat"] 
s1 = "geek"

# creating enumerate objects 
obj1 = enumerate(l1) 
obj2 = enumerate(s1) 

print "Return type:",type(obj1) 
print list(enumerate(l1)) 

# changing start index to 2 from 0 
print list(enumerate(s1,2)) 
  • import sys character= sys.argv[1] count= int(sys.argv[2]) def generateString(char, val): I forgot to add the arguments from the command line – jacob sampson Aug 04 '19 at 21:31