Here is how the C++ code you provided can be converted to Python:
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}
# Python code
print("Hello World!")
In Python, the print() function is used to output text to the console, whereas in C++ the std::cout object is used for the same purpose. Additionally, in C++ the return 0; statement at the end of the main() function is used to indicate that the program has run successfully, while in Python this is not necesscary
Comments
Post a Comment