python programming problem

For students who are taking a programming course, may be restricted in what they can use, or have other unusual limitations on solving their task.

python programming problem

Postby rishav » Wed Sep 21, 2016 10:18 am


Define a function generate_n_chars() that takes an integer n and a character c and returns a string, n characters long, consisting only of c:s. For example, generate_n_chars(5,"x") should return the string "xxxxx". (Python is unusual in that you can actually write an expression 5 * "x" that will evaluate to "xxxxx". For the sake of the exercise you should ignore that the problem can be solved in this manner.)
Last edited by micseydel on Wed Sep 21, 2016 4:17 pm, edited 1 time in total.
Reason: Initial post lock.
Posts: 1
Joined: Wed Sep 21, 2016 10:09 am

Re: python programming problem

Postby micseydel » Wed Sep 21, 2016 4:19 pm

We're not going to do your homework for you, but we'd love to help you learn Python. To start with, what have you tried?
Due to the reasons discussed here we will be moving to on October 1, 2016.

This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 3000
Joined: Tue Feb 12, 2013 2:18 am
Location: Mountain View, CA

Return to Homework

Who is online

Users browsing this forum: No registered users and 2 guests