Welcome to Raspberry Pi 4B repository
2.Print basic usage
Step 1: Create a file to store the project
mkdir Python
Step 2:Enter this folder
cd Python/
Step 3:Create and open helloworld.py file.
nano helloworld.py
Step 4: Writing code
print('Hello World!') #Print string
str = 'Hello Yahboom' #Print variable
print(str)
print('1024*2 =',1024*2,' 1024/2 =',1024/2) #Print calculation results (without line break)
List = [1,2,'a',3+3,3*3,str] #Print list
print(List)
After writing, press Ctrl + X to exit this file.
The system will prompt you whether you need to save, press Y to save and exit.
Step 5: Run this code
python3 helloworld.py
We can see that the system will print out the prompt as shown below.