1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Trying to have an output repeat

  1. Apr 25, 2010 #1
    How do you make a string repeat itself for a given number of times?
    For example, if I wanted to make "3y" print out "yyy" on the screen (it prints "y" 3 times because the number in the input is 3).. how would i do this using functions?
  2. jcsd
  3. Apr 26, 2010 #2
    you could just parse the input string; but of course, you will need to include some specifications, or the input/output you want can be very vague ('33y') can be 33 times of y or 3 times of 3y.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook