In my former blogs, I already explained a couple of thinks that you can get as output while using print(). I am going to repeat a couple of them and explain some new things that print() can do:
- If you just use print(abcd), Python is going to print the value of abcd. So if you use print(abcd), you first need to define abcd with a value:
- If you use print(“abcd”), Python is going to print just abcd, so you don’t need to define something first:
- You can also combine this, but then you need to place a comma in between the parts.
- Print can even display lists, dictionaries and built in function, as long as you keep separating them with commas:
- You can also put in your print the way that the different segments needs to be separated. You achieve that by adding in your print sep=’-‘. Between the quotes you can put the way of separating them. In this example I used a line, a > and a question mark to separate the segments:
Hopefully you learned a lot of new things that you can do with print!