Python Forum
How to print string multiple times on new line
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to print string multiple times on new line
#1
How do I get the below to print the output 4 x and each print to start on a new line

name = input("What is your name: ")

age = input("What is your age: ")

result = str(2020 + (100 - int(age)))

print(4 * ("Hello " + name +" you will be 100yrs old in the year " + result + ". "))
Thanks
Reply


Messages In This Thread
How to print string multiple times on new line - by ace19887 - Sep-30-2020, 12:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem with spliting line in print akbarza 3 388 Jan-23-2024, 04:11 PM
Last Post: deanhystad
  splitting file into multiple files by searching for string AlphaInc 2 901 Jul-01-2023, 10:35 PM
Last Post: Pedroski55
  File "<string>", line 19, in <module> error is related to what? Frankduc 9 12,576 Mar-09-2023, 07:22 AM
Last Post: LocklearSusan
  Trying to loop through code to plot seaborn line plots across multiple subplots eyavuz21 0 1,680 Dec-05-2022, 10:46 AM
Last Post: eyavuz21
  Print the line before the corrent line tester_V 9 1,575 Nov-18-2022, 08:39 AM
Last Post: Gribouillis
  Writing string to file results in one character per line RB76SFJPsJJDu3bMnwYM 4 1,382 Sep-27-2022, 01:38 PM
Last Post: buran
  Remove a space between a string and variable in print sie 5 1,786 Jul-27-2022, 02:36 PM
Last Post: deanhystad
  Inserting line feeds and comments into a beautifulsoup string arbiel 1 1,191 Jul-20-2022, 09:05 AM
Last Post: arbiel
  Matching multiple parts in string fozz 31 6,294 Jun-13-2022, 09:38 AM
Last Post: fozz
  Can you print a string variable to printer hammer 2 1,951 Apr-30-2022, 11:48 PM
Last Post: hammer

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020