Using Variables¶

Write a program that creates three variables: an int, a float, and a str (string).

Name the file: using_variables.py

Put the value 113 into the first variable, the value 2.71828 into the second, and the value "Computer Science" into the third. It does not matter what you call the variables… this time.

Then, display the values of these three variables on the screen (one per line) as per the example output:

This is room #113 
e is close to 2.71828 
I am learning a bit about Computer Science 

Your program SHOULD NOT look like this:

print("This is room # 113")
print("e is close to 2.71828")
print("I am learning a bit about Computer Science")

You must use three variables and inject them into the output string using f-strings, “dot format” or string concatenation. Your program will probably have six lines of code.


©2021 Daniel Gallo

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.

Creative Commons License

Adapted for Python from Graham Mitchell’s Programming By Doing