Basic Output in Python

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!

Advertenties

Plaats een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit /  Bijwerken )

Google photo

Je reageert onder je Google account. Log uit /  Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log uit /  Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit /  Bijwerken )

Verbinden met %s

Maak je eigen website aan bij WordPress.com
Aan de slag
%d bloggers liken dit: