About 185,000 results
Open links in new tab
  1. python - Multiplication with int and str - Stack Overflow

    Python is dynamically typed, and the * operator works for both integers and strings, so you don't need to care about what the function input is. What about: return x+x. or. return x*2. Both …

  2. How to Use Python to Multiply Strings

    There are a few different ways that we can go about multiplying strings, depending on how you want your multiplied strings to be formatted. Take a look at the code snippets below to see …

  3. How to Multiply in Python? [With Examples] - Python Guides

    Aug 8, 2024 · In this tutorial, I will show you how to multiply in Python using different methods with examples. I will also show you various methods to multiply numbers, lists, and even strings in …

  4. Create multiple copies of a string in Python by using multiplication ...

    Dec 31, 2024 · In this article, we will focus on how to achieve this efficiently. This method is the easiest way to repeat a string multiple times in Python. It directly gives us the repeated string …

  5. How to use multiplication with strings | LabEx

    Explore powerful Python string multiplication techniques to efficiently repeat and manipulate text strings, enhancing your coding skills with practical string operations.

  6. Multiply a string by a number! - Code Golf Stack Exchange

    Jul 12, 2017 · Write a function or program that multiplies two inputs, a string and an integer. To (properly) multiply an string by an integer, you split the string into characters, repeat each …

  7. Beginner’s Guide on How to Multiply Strings in Python – A …

    We learned how to multiply strings with constant values, utilize variables and expressions in string multiplication, and apply advanced techniques like creating string patterns and replicating …

  8. multiply string by number python - Stack Overflow

    def repeat_number(num): if isinstance(num, int): return int(str(num) * 3) else: return None >>> repeat_number(241) 241241241

  9. Math and Comparison | How to Store Text in Strings in Python - InformIT

    Oct 25, 2013 · When you multiply a string by an integer, Python returns a new string. This new string is the original string, repeated X number of times (where X is the value of the integer). In …

  10. Can you multiply a string by an integer in Python?

    Apr 2, 2020 · How to multiply a string with an integer in Python? In python, to multiply string with an integer in Python, we use a def function with parameters and it will duplicate the string n …

  11. Some results have been removed
Refresh