FIGURE 4.4 The script0402.py output, properly tabbed.
- To try adding some input into your script, at the command-line prompt, type nano
py3prog/script0402.py and press Enter. - Go to the bottom of the script and add the additional Python statements shown here:
Click here to view code image
#
################## Get Input ####################
#
print ()
print ("Now you may change the variables' values.")
print ()
#
amount=int(input("How many vessels are there? "))
print ()
#
vessels = input("What type of vessels are being used? ")
print ()
#
liquid = input("What type of liquid is in the vessel? ")
print ()
#
location=input("Where are the vessels located? ")
print ()
#
################# Display New Input to Output ###########
#
print ("So you believe there are", amount, vessels, "of", liquid,
location, end='. \n')
print ()
#
#################### End of Script ######################
- Write out the modified script by pressing Ctrl+O. Press Enter to write out the
contents to the script0402.py script. - Exit the nano text editor by pressing Ctrl+X.
- Type python3 py3prog/script0402.py and press Enter to run the script.
Answer the prompts any way you want. (You are supposed to be having fun here!)
Figure 4.5 shows what your output should look like.