0% found this document useful (0 votes)
130 views2 pages

FIT9136 - Workshop 2.: Task 1: Finding Information

The document outlines 9 tasks related to learning Python syntax and programming concepts: 1) finding Python syntax information and avoiding plagiarism, 2) Python data types and their differences, 3) naming variables, 4) writing a calculator script, 5) documenting code, 6) converting temperatures between Fahrenheit and Celsius, 7) greeting a user by name and age, 8) calculating areas of shapes from user input, and 9) modifying scripts to take input and output from files.

Uploaded by

duy thọ lê
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views2 pages

FIT9136 - Workshop 2.: Task 1: Finding Information

The document outlines 9 tasks related to learning Python syntax and programming concepts: 1) finding Python syntax information and avoiding plagiarism, 2) Python data types and their differences, 3) naming variables, 4) writing a calculator script, 5) documenting code, 6) converting temperatures between Fahrenheit and Celsius, 7) greeting a user by name and age, 8) calculating areas of shapes from user input, and 9) modifying scripts to take input and output from files.

Uploaded by

duy thọ lê
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

FIT9136 – Workshop 2.

Task 1: Finding Information


Where can you get information on Python syntax? At what point does ‘research’ turn into plagiarism?

Task 2: Python Types


What are the different types available in Python?
ˆ What are their differences?

ˆ Why is there an Integer, and a Float?

Task 3: Naming Variables


What would be good names for variables for the following (also try to identify the type):

ˆ Dimensions for a rectangle

ˆ Money in Australian Dollars

ˆ Someone’s Age

ˆ Someone’s Name

ˆ Your tutor’s favourite food

ˆ Your favourite food

Task 4: Calculator
Code a script that stores two integer numbers as ‘x’ and ‘y’, then performs the following operations: +,-
,÷,×,mod,x sin(y)
Note: for the sake of this question you will be asked to change your file. Each time make a new copy of your
script to make the changes.

ˆ Ensure that your statements print in a way that isn’t ambiguous.

ˆ At the end print the types of both x and y.

ˆ Rather than hardcoding ‘x’ and ‘y’, try taking input from the user. Did you have any problems just using
‘input()’ ?
ˆ Printing is one way of providing output. The other is writing to a file. Change your calculator script to
do this.

Task 5a: Documenting your Code


Code documentation is the marker of a great developer. Technically speaking you should write your documen-
tation before you start to code. Why do you think that is?

1
Task 5b: Documenting your Code
For your calculator script, try adding the following as part of a comment header:

ˆ Your name

ˆ Date the script was created

ˆ Date the last edit was made

ˆ Description of the purpose of the code

This list isn’t exhaustive, but most comment headers include the above. Whatever style you choose, include
them.

Task 6: Converting Temperature


Make a script that converts temperature from Fahrenheit to Celsius and prints it. The formula for this is:
5
C = (F − 32) × 9

Task 7: Greetings
Take as input a first name, a last name, and an age. Then print out a message formally displaying the inputs.
E.g. “Hey there Gavin Kroeger! You are 28 years old!” Try doing this using variables and without using
variables.

Task 8: Shapes
Take as input a height and a width then print the areas of a rectangle and a triangle for these measurements
(you may assume width is base for a triangle). Try and shortcut your calculations as much as possible.

Task 9: Files
For a script that does not have it, try and convert your code to work entirely on files. Take your input as
separate lines from a file, and output your results to another file.

You might also like