Question

I am new at prgraming in python and I was wondering how you can create a...

I am new at prgraming in python and I was wondering how you can create a new line within a print statment. I tried using \n but i keep getting an error
0 0
Add a comment Improve this question Transcribed image text
Answer #1

To create new line withing a print statement, we have to use end="\n" within the print statement.

Ex: For new line.

for i in range(3):
print(i, end="\n") #Even if we do not use "\n" here, it will automatically gives new line.

Output:

1

2

3

Add a comment
Know the answer?
Add Answer to:
I am new at prgraming in python and I was wondering how you can create a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Code is in C++: Im wondering how i can make the program continue to ask the...

    Code is in C++: Im wondering how i can make the program continue to ask the user to enter Y/N with the if statment. Is it possible with an If statment? #include <iostream> using namespace std; int main() { float usDollars,cYuan; float *Dollars; char choice; Dollars = &usDollars; while(usDollars >= 0){ cout <<"Enter the amount in U.S Dollars: "; cin >> usDollars; cout << usDollars<< " U.S Dollar in Chinese Yuan is :"<<*Dollars*7.09<<endl; if (choice == 'y' || choice ==...

  • I am new to Python and am having trouble coming up with writing code to the...

    I am new to Python and am having trouble coming up with writing code to the following problem... The program must: Prompt for a file name Opens that file and reads through the file Displays a custom error message if the file does not exist You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon. From [email protected] Sat Jan 5 09:14:16 2008 Accumulated the...

  • I am using python and I want to know how I can get the spacing between...

    I am using python and I want to know how I can get the spacing between the low mid and high to be dependent on the range and how I can get that boarder to be dependent on the range as well. Im not sure what you mean, I just want to know about the spacing. Modify your project1.py Python program so that it displays the low, mid and high point values for periodic function and a double-line border. (HINT:...

  • I am wondering if you can help me out with these questions. I am very confused....

    I am wondering if you can help me out with these questions. I am very confused. 1. A math teacher gave her class two tests. While 70% of the class passed the first test and 75% of the class passed the second test, only 65% of the class passed both. Given that the students failed the first test, what probability of those will passed the second test? 2. In the game of roulette, a player can place a $5 bet...

  • How can I create a fractal spiral like a fibbonacci spiral in Python without turtle. I...

    How can I create a fractal spiral like a fibbonacci spiral in Python without turtle. I am working with object oriented programming/

  • I am currently doing homework for my java class and i am getting an error in...

    I am currently doing homework for my java class and i am getting an error in my code. import java.util.Scanner; import java.util.Random; public class contact {       public static void main(String[] args) {        Random Rand = new Random();        Scanner sc = new Scanner(System.in);        System.out.println("welcome to the contact application");        System.out.println();               int die1;        int die2;        int Total;               String choice = "y";...

  • In python, within a class's method, how can I create an attribute (field) named _age and...

    In python, within a class's method, how can I create an attribute (field) named _age and initialize its value to 47?

  • I am trying to create tkinter GUI for guess a number game.I am not able to...

    I am trying to create tkinter GUI for guess a number game.I am not able to complete it .Could someone guide me to complete.I am so confused about using tkinter in while loop . Below code is not working correctly .Could someone please help with this ? def get_binary_digits(dividend): binary_digits = [] while dividend != 0: quot = dividend // 2 remainder = dividend % 2 binary_digits.append(remainder) dividend = quot # The quotient becomes the new dividend. binary_digits.reverse() return binary_digits...

  • Hey! i hit a roadblock in my C# program. I am just wondering how i would...

    Hey! i hit a roadblock in my C# program. I am just wondering how i would search for a set of 9 numbers within an array and have a message box say if it was there or not. I have it where the contents of the txt file is loaded into an array right when the program starts. Any and all help is greatly appreciated :) each number in the txt file is like this 123445567 385910475 938405719 503818405 the...

  • Python help: Given the lists, lst1 and lst2, create a new sorted list consisting of all...

    Python help: Given the lists, lst1 and lst2, create a new sorted list consisting of all the elements of lst1 that also appears in lst2. For example, if lst1 is [4, 3, 2, 6, 2] and lst2 is [1, 2, 4], then the new list would be [2, 2, 4]. Note that duplicate elements in lst1 that appear in lst2 are also duplicated in the new list. Associate the new list with the variable new_list, and don't forget to sort...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT