Category: Python3

Added: 7th of December 2020

Viewed: 1,460 times

Learning Python 3, getting basic user input and printing the results

The following code takes basic user input in Python 3 and then prints out the results.
Create a new file named then copy and paste the code the below.


name = input("what is your name? ")
age = input("how old are you? ")
os = input("What is your favourite programming language? ")

print ("Hello " +name+ " you are ",age," years old. \nYour favourite programming langauge is " +os)

Save the file then enter the following command to make it executable on Linux
chmod +x

Then run the file by entering the following in the terminal