Files
python101_for_students/somescript.py
T
2026-11-07 20:19:25 -05:00

22 lines
920 B
Python
Executable File

#!/usr/bin/env python
#this tells linux and mac operating systems that this file is a python file. Windows may use it as a hint as well
#everything after a pound sign is a comment
"""
Comments can go between triple quotation marks
"""
import math #imports the builtin math library
print("Hello world") #a builtin functio nto write to the terminal
print("The value of pi is " + str(math.pi))
#this is doing a few things
# "The value of pi is " - this is a string literal
# "The value of pi is " + (something else) - we are concatenating something else to this string
# math.pi - this is a floating point constant in the math library
# (it's cast to a string and the resulting concatenated string is something like "The value of pi is 3.141592653589793")
# print(the string) - prints that to the terminal
print("The value of pi is", math.pi) #another way to do it