Python 3.7 n after a loop [on hold]
$begingroup$
Hey I wrote the following code for an assigment:
def triangular_area():
for i in range(0, 10):
print(((i+1)**2)/2, end=" ")
and it prints the following:
0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0
however, If I call another function that prints a random string right after I call triangular_area, it prints the string in the same line like that:
0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0 "random str"
how can I insert a single n that will occur in the end of for statment?
the machine should read: 0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0n
thanks
python-3.x
New contributor
trizz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
put on hold as off-topic by πάντα ῥεῖ, Ludisposed, Vogel612♦ 3 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, Ludisposed, Vogel612
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
$begingroup$
Hey I wrote the following code for an assigment:
def triangular_area():
for i in range(0, 10):
print(((i+1)**2)/2, end=" ")
and it prints the following:
0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0
however, If I call another function that prints a random string right after I call triangular_area, it prints the string in the same line like that:
0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0 "random str"
how can I insert a single n that will occur in the end of for statment?
the machine should read: 0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0n
thanks
python-3.x
New contributor
trizz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
put on hold as off-topic by πάντα ῥεῖ, Ludisposed, Vogel612♦ 3 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, Ludisposed, Vogel612
If this question can be reworded to fit the rules in the help center, please edit the question.
$begingroup$
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
$endgroup$
– Vogel612♦
3 hours ago
add a comment |
$begingroup$
Hey I wrote the following code for an assigment:
def triangular_area():
for i in range(0, 10):
print(((i+1)**2)/2, end=" ")
and it prints the following:
0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0
however, If I call another function that prints a random string right after I call triangular_area, it prints the string in the same line like that:
0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0 "random str"
how can I insert a single n that will occur in the end of for statment?
the machine should read: 0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0n
thanks
python-3.x
New contributor
trizz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
$endgroup$
Hey I wrote the following code for an assigment:
def triangular_area():
for i in range(0, 10):
print(((i+1)**2)/2, end=" ")
and it prints the following:
0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0
however, If I call another function that prints a random string right after I call triangular_area, it prints the string in the same line like that:
0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0 "random str"
how can I insert a single n that will occur in the end of for statment?
the machine should read: 0.5 2.0 4.5 8.0 12.5 18.0 24.5 32.0 40.5 50.0n
thanks
python-3.x
python-3.x
New contributor
trizz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
trizz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
trizz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 4 hours ago
trizztrizz
1
1
New contributor
trizz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
trizz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
trizz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
put on hold as off-topic by πάντα ῥεῖ, Ludisposed, Vogel612♦ 3 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, Ludisposed, Vogel612
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by πάντα ῥεῖ, Ludisposed, Vogel612♦ 3 hours ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, Ludisposed, Vogel612
If this question can be reworded to fit the rules in the help center, please edit the question.
$begingroup$
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
$endgroup$
– Vogel612♦
3 hours ago
add a comment |
$begingroup$
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
$endgroup$
– Vogel612♦
3 hours ago
$begingroup$
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
$endgroup$
– Vogel612♦
3 hours ago
$begingroup$
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
$endgroup$
– Vogel612♦
3 hours ago
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
Welcome to Code Review! I'm afraid this question does not match what this site is about. Code Review is about improving existing, working code. Code Review is not the site to ask for help in fixing or changing what your code does. Once the code does what you want, we would love to help you do the same thing in a cleaner way! Please see our help center for more information.
$endgroup$
– Vogel612♦
3 hours ago