• Register
1 vote
19 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 25 views
25 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
1 vote
1 answer 53 views
53 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 14 views
14 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
1 vote
1 answer 45 views
45 views
Probelm: I have 4 values that are: a = 9 b = 13.58 c = "allforallinall" d = [9, 13, 99] For those four values I tried to print which type of a variable they are, So I wrote this python program: a = 9 b = 13.58 c = "allforallinall" d = [9, 13, ... If this is not the way to print the type of a variable which is and how to print the type of a variable using a python program. Thanks in advance.
asked May 17, 2020 samhaz 5k points
0 votes
2 answers 77 views
77 views
I am a beginner to python and am at the moment having trouble using the command line. I have a script test.py (which only contains print("Hello.")), and it is located in the map C:\Python27. In my system variables, I have specified python to be C:\Python27 (I have ... but when I do so I get this: File "<stdin>", line 1 python test.py ^ SyntaxError: invalid syntax What is wrong? Thanks in advance!
asked Oct 25, 2020 psandprop 2.4k points
0 votes
1 answer 25 views
25 views
How to take two input in the same line from user? Like What is your name and age?
asked Oct 10, 2020 Ahsan 1.8k points
0 votes
1 answer 9 views
9 views asked Oct 22, 2020 Shaad Sh 800 points
1 vote
1 answer 51 views
51 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 8 views
8 views asked Oct 22, 2020 Shaad Sh 800 points
0 votes
0 answers 22 views
22 views
I have a text file that consists of similar lines and few are half similar to other lines in a text file. Input.txt I would like to play: Volleyball I would like to play: Volleyball I would like to play: TableTennis I would like to play: Baseball I do not know how ... collected[key]}\n') I can print only the second line. Don't know where I am going wrong. Any help would be appreciated. Thank you
asked Jul 16, 2020 anonymous