Doing some lab questions and I came across this one, been stuck on it for ages not sure what to do from here, heres my code:
import sys import math for number in sys.stdin: number = number.strip() pi = str(math.pi) print(format(pi, number))
My code is just printing pi, also i forgot to mention Im still a beginner so we haven't come across every technique.
you could use round instead format:
import sys import math for n in sys.stdin: number = int(n.strip()) pi = math.pi print(round(pi, number))
2.1m questions
2.1m answers
60 comments
57.0k users