Printing string n times

JK JK 2038 
Created at  
7,121 0 0

In Python, you don't need to repeat commands/functions to print a string. You can simply implement it like:

n = 2
s = "programming"
print( s * n)
Tags Print String Python Repeat print Facebook X
Comments 0
Similar posts
  1. String concatenation by join()
    7,185
  2. Python Arithmetic Operators
    7,142
  3. Python Comparison Operators
    7,344
  4. Python Lists
    7,458
  5. Python String Operations
    7,539
  6. Python Data Types
    7,552
  7. Python Tuples
    7,265
  8. Python Sets
    7,170
  9. Python Dictionaries
    7,165
  10. Python Variables
    7,517
  11. Python Comments
    7,674
  12. Python Syntax
    7,501
  13. Python Conditions and If statements
    7,188
  14. Python Getting Started
    7,572
  15. Python Introduction
    7,165
  16. What is Python?
    7,826
  17. Python While Loops/For Loops
    7,620
  18. Python Functions
    7,125
  19. Python Lambda
    7,174
  20. Python Arrays
    7,166
  21. Python Classes/Objects
    7,580
  22. Python Inheritance
    7,272
  23. Python Iterators
    7,177
  24. Python Polymorphism
    7,160
  25. Python Scope
    7,134
  26. Python Modules
    7,179
  27. The Print() Method
    7,226
  28. Code Chronicles - A Caffeine-Fueled Journey into Data Software Engineering
    7,462
  29. Machine Learning Types and Programming Languages
    7,330
  30. Python Tutorials for AP Computer Science Principles, Data Projects and High School Internship
    8,054
  31. Mastering Excel Data Manipulation with Python
    7,147
  32. Challenge: One Code Problem Per Day
    1,262
  33. Clean Python Environments: The Power of venv vs. Docker
    1,069
  1. How to Build Llama 3 AI Apps with Python: Setup & User Prompts
    1,040
  2. Try...Catch Helps Ignoring Data Type Miss-Match Error in Python
    9,561
  3. RegExp example in Python to exclude javascript from HTML code
    7,119
  4. Python code to convert from Lunar to Solar
    7,898
  5. Python example to download webpage
    8,872
Recently updated
  1. Comprehensive Guide to Recent Critical PHP Vulnerabilities
    749
  2. How to Check Your UIUC Graduation Progress Using DARS Audit
    654
  3. Michael Jackson's Billie Jean
    363
  4. Meet A2O Lite: Korea's Newest K-Pop Cuties with Addictively Catchy Melodies
    297
  5. Why You Can't Stop Watching Jack Bryan's Beatbox Gaming Shorts
    302
  6. Song So-hee: The Soulful Voice Touching Hearts Through Korean Music
    321
  7. Watch This Dazzling Dancer’s Mind-Blowing Moves
    337
  8. Bootstrap vs. Tailwind CSS: Origins, Features, Pros & Cons, and How to Choose the Right Framework
    363
  9. The Complete Guide to Golang: History, Features, Real-World Uses, and Code Examples
    1,166
  10. Telemetry vs. Analytics: Understanding the Difference and Why It Matters
    512
  11. The Evolution and Production Reality of Agentic AI
    397
  12. How to Activate or Waive Your UIUC Student Health Insurance
    507
  13. Complete Guide to Building a Machine Learning Model
    519
  14. My life cuts at Las Vegas during Thanksgiving day holiday
    7,585
  15. The Cybercab Transformation: From Autonomous Taxi to Mobile Base Station
    540
  16. Harness vs. OpenClaw: Two Very Different "Agents"
    1,312
  17. What is Docker? Why is Docker also useful in a development environment?
    787
  18. UIUC 2026-2027 Academic Calendar
    1,952
  19. Open-Source LLMs: The AI Revolution
    956
  20. Resume 2.0: Leveling Up for My First Software Gig
    2,865
  21. Not everyone will understand what this man just did
    2,359
  22. UIUC Dorm Guide: Find Your Perfect Fit !!
    1,817
  23. Unpacking IU's Shopper
    955
  24. Jackie Chan's Police Story: The Action Masterpiece
    833
  25. The IVE Story: Identity, 'I AM' Charts, and Influence
    1,162
  26. Tech Visionaries who graduated at UIUC - You are the Next Turn
    1,360
  27. Open Databases for Sex Crime Occurrences in the U.S.
    937
  28. Automatically copy text to the clipboard when dragging the mouse in the Cursor
    3,287
  29. My First Day at University of Illinois-Urvana Champaign
    1,356
  30. Sand, Sea, and a Splash of Fun at Newport Beach: A Family Adventure
    8,379
  31. Sun, Rocks, and Adventure: A Day at Joshua Tree National Park
    8,450
  32. Sipping the Stars: My Starbucks Adventure
    10,067
  33. Exciting explore at Sequoia National Park
    7,840
  34. My Life Shot at Death Valley
    2,006
  35. Ip Man fights with Muay Thai Master
    1,109
  36. Mad Clown - Don't Die
    1,226
  37. How to get Student Enrollment and Degree Verification at UIUC
    5,712
  38. LAX Thanksgiving Rush: A Joyful Reunion
    1,065
  39. ZO ZAZZ(조째즈) - Don`t you know (모르시나요) (PROD.ROCOBERRY)
    1,327
  40. FISHINGIRLS Unleashes Energetic EP 'Funiverse' Featuring Signature Track 'Fishing King'
    1,134
  41. 10CM - To Reach You (너에게 닿기를)
    1,314
  42. Feeling weak? Transform yourself at the UIUC ARC!
    1,718
  43. BOYNEXTDOOR - If I Say I Love You
    1,350
  44. The Future of Software Engineer - AI Engineering
    1,074
  45. G Dragon x Taeyang (Eyes Nose Lips, Power, Home Sweet Home, GOOD BOY) - LE GALA PIÈCES JAUNES 2025
    1,084
  46. Lie - Legend song by BIGBANG
    7,980
  47. Why ROLLBACK is useful when you work with Google Gemini CLI?
    1,080
  48. Reimbursement after Vaccination at McKinley Health Center
    1,190
  49. Gemini CLI makes a Magic! Time to speed up your app development with Google Gemini CLI!
    1,130
  50. Common Questions from UIUC school life in terms of CS Program
    1,312