3 ms·
note: void main should be int main(at least in c++) You could just give from __future__ import print_function import os def main(): print(
by rat87 12y ago
note: void main should be int main(at least in c++)
You could just give
from __future__ import print_function
import os
def main():
print("hello world from:" + os.name)
if __name__ == "__main__":
main()
as the hello world that covers functions(main/print), entry points(python runs the code top to bottom defining classes and functions at the top level and running any other code it encounters, to allow importation of libraries we put the code we wish to run in a special block that only runs it when the script is the only being directly run, not imported), we imported os and used os.name to demonstrate a library, + is an operator.