menu COMPSCI 2120/9642/DIGIHUM 2220 1.0 documentation

Problem Set 1

Problem 1.1

Consider the following sentence: “Python is the best programming language”.

Write a Python script which stores each word of that sentence into its own variable and then prints the whole sentence out using a single print statement.

Problem 1.2

Fix the errors in the following Python code, which is meant to return the sum of a and b. Identify each error as a syntax, runtime, or semantic error:

a:=3
8 = b
b = 8
c = a plus b
print a

Problem 1.3

Generate expressions to:
  1. add two variables,

  2. multiply two variables and then add a third

  3. divide the expression from 1. by the expression from 2.

  4. convert a temperature in Celsius to Fahrenheit.