Skip to main content
  1. Python za inženirje - video/

007 - Izpis tabele 2

Pzi Python
Table of Contents
Python za inženirje - video - This article is part of a series.
Part 7: This Article
Lepši izpis tabele, množenje niza znakov, …

Povezave
#

Izvorna koda
#

tabela.py
#

#!/usr/bin/env python

import math

radiji = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

s = "{:>6} | {:>10} | {:>10}".format("Radij", "Ploščina", "Obseg")
print(s)
print("-" * len(s))
for r in radiji:
    pl = math.pi * r**2
    ob = 2 * math.pi * r
    print("{:6d} | {:10.3f} | {:10.3f}".format(r, pl, ob))
Python za inženirje - video - This article is part of a series.
Part 7: This Article