Class 1 Lab 4 ‐ Variables and Data Types - Justin-Boyd/Python-Class GitHub Wiki

Task 1

  • Click on File from the top menu and select New File. Verify the displayed workspace is /home/student/workspace, type main.py as the file name, and click OK.

Task 2

name = "Your name"

Task 3

age = 42

Task 4

flag = True
// or
flag = False

Task 5

print(name)

Task 6

datatype = type(42)

Task 7

datatype = type("Hello World!")

Task 8

datatype = type(True

Task 9

user_name = input("Please insert your name > ")

Task 10

user_age = int(input("Please insert your age > "))

Task 11

print("Hello, " + user_name + ". You are " + str(user_age) + " years old.")

# or

print("Hello, {}. You are {} years old.".format(user_name, user_age)