1

I started Replit's 100 days of coding. The intial assignment that is asked for is writing a single print code stating:

Name Date I am signing up for Replit's 100 day's of Python challenge! I will make sure to spend some time every day coding along, for a minimum of 10 minutes a day I'll be using Replit, an amazing online IDE so I can do this from my phone wherever I happen to be. No excuses for not coding from the middle of the field! I am feeling

Problem: I think my code isn't efficient. I also cant get it to run without having spaces at the beginning of the sentences. Can someone point out what I did wrong?

This is my code. It printed out what I wanted it to say. I got the inspiration from a reddit user to format this way. It doesn't print out correctly how it should. I also think there a better way of writing this to be more efficient.

first_name = "Humberto"
date_today = "January 19, 2023"
text_output = """I am signing up for Replit's 100 day's of Python challenge!"""
txt_output = """I will make sure to spend some time every day coding along, for a minimum of 10 minutes a day"""
text_put = """I'll be using Replit, an amazing online IDE so I can do this from my phone wherever I happen to be. No excuses for not coding from the middle of the field! """
fee_ling = "I am feeling \U0001f600"
print(first_name,'\n',date_today,'\n',text_output,'\n',txt_output,text_put,'\n',fee_ling )

Thoughts or opinions?

The6thSense
  • 8,103
  • 8
  • 31
  • 65

1 Answers1

0

You can use sep= parameter of the print() function:

print(first_name, date_today, text_output, txt_output,text_put, fee_ling, sep='\n')

Prints:

Humberto
January 19, 2023
I am signing up for Replit's 100 day's of Python challenge!
I will make sure to spend some time every day coding along, for a minimum of 10 minutes a day
I'll be using Replit, an amazing online IDE so I can do this from my phone wherever I happen to be. No excuses for not coding from the middle of the field! 
I am feeling 
Andrej Kesely
  • 168,389
  • 15
  • 48
  • 91