• Register
1 vote
25 views

I am new to pyhotn programming I was trying to write a program for my practice but I failed to execute an empty line in my output. The code I wrote is :

def DoTheWork(worker):
    print("Its an oder to you")
    print("Please do the work" + " " + worker  )
    print("In one day")
    

DoTheWork('Kamrul')
DoTheWork('Noman')

And gives me the output :

Its an oder to you
Please do the work Kamrul
In one day
Its an oder to you
Please do the work Noman
In one day

I am getting no errors but I failed to execute an empty line .

Can anyone help me out.

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

0 votes

To execute a blank line or an empty line in your python you should use :

print("\n")

So your programm should be like:

def DoTheWork(worker):
    print("Its an oder to you")
    print("Please do the work" + " " + worker  )
    print("In one day\n")
    

DoTheWork('Kamrul')
DoTheWork('Noman')

and you will get the output:

Its an oder to you
Please do the work Kamrul
In one day

Its an oder to you
Please do the work Noman
In one day

It should help you out.

11 6 4
34,950 points

Related questions

0 votes
1 answer 31 views
31 views
Problem: In C++, \n is used in various conditions, but what do I use in Python I am a bit confused? I don't want to have to use: print (" "). This doesn't seem a very good way to implement. Any help will be great!
asked Jun 3, 2020 Gavin 15.3k points
0 votes
1 answer 3 views
3 views
Problem: I want to print in a new line in python, help me to do it.
asked 5 days ago zayed1 35.6k points
1 vote
1 answer 83 views
83 views
I am trying to write a script to print specific words after a particular string. Here is the input file Theyare "playing in the ground", with friends Theyare "going to Paris", with family Theyare "motivating to learn new things", by themselves In the output I am trying to select "are" as the keyword ... open ('input.txt', 'r') as f: for lines in f: a = re.search(r'\bare', f): if a: print (lines)
asked Jul 15, 2020 anonymous
0 votes
1 answer 1 view
1 view
Problem: Print new output on same line.I want to print the looped output to the screen on the same line.How do I do this in the simplest way for Python 3?
asked 1 day ago sumaiya simi 16.3k points
0 votes
1 answer 21 views
21 views
Problem: Hi, I know I am asking a silly question but how do you print in the next line in python?
asked Oct 8, 2020 Ahsan 1.8k points
0 votes
1 answer 4 views
4 views
Problem: anyone who know this problem please help? python how to print on the same line
asked Mar 23 Rohit kr 16.2k points
0 votes
1 answer 13 views
13 views
Problem: I searched around but i couldn't find any post to help me fix this problem, I found similar but i couldn't find any thing addressing this alone anyway. Here's the the problem I have, I'm trying to have a python script search a text file, the text file has numbers in a ... output is every thing containing a 2 and a 0, so i get 220 foo 200 bar etc. How can i fix this so it just find "20"
asked Feb 20 Mashhoodch 13k points
1 vote
1 answer 4 views
4 views
Problem: Please help me. How can I solve it? python print on the same line
asked Mar 19 MUHAMMAD MUNEEB 83k points
1 vote
1 answer 99 views
99 views
Problem: I am a python newbee. I was trying to print string and int on same line of a python code. The code I wrote is: a = int(input("Please Enter a Number: ")) print("Your Number is" a) but when I run this it shows an error message: File "main.py", line 2 print("Your Number is" x) ^ SyntaxError: invalid syntax I am not able to do this please help me to solve this problem?
asked Mar 27, 2020 LizzyM 6.1k points
0 votes
1 answer 3 views
3 views
Problem: Please solve it … Because I am unable to find out the solution... import sys for line in sys.stdin: print(line, end="")
asked Mar 31 Ifra 24.4k points