-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
505 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print (97*43) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print ("Hello Greenwich!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
number1_str = input("First number: ") | ||
number2_str = input("Second number: ") | ||
number1 = int(number1_str) | ||
number2 = int(number2_str) | ||
combination = number1 * number2 | ||
combination_str = str(combination) | ||
print("Answer: " + combination_str) | ||
|
||
print() | ||
input("Press return to continue ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
print ("This is my first program") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
print("Answer: " + str(int(input(" First number: ")) / int(input("Second number: ")))) | ||
|
||
print() | ||
input("Press return to continue ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from random import randint | ||
|
||
min_str = input("Min: ") | ||
max_str = input("Max: ") | ||
minimum = int(min_str) | ||
maximum = int(max_str) | ||
random1 = randint(minimum, maximum) | ||
random2 = randint(minimum, maximum) | ||
random3 = randint(minimum, maximum) | ||
random4 = randint(minimum, maximum) | ||
random5 = randint(minimum, maximum) | ||
print(str(random1) + " " + str(random2) + " " + str(random3) + " " + str(random4) + " " + str(random5)) | ||
|
||
print() | ||
input("Press return to continue ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from turtle import * | ||
forward (200) | ||
left (90) | ||
forward (100) | ||
left (90) | ||
forward (200) | ||
left (90) | ||
forward (100) | ||
left (90) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from turtle import * | ||
|
||
forward (100) | ||
left (90) | ||
forward (100) | ||
left (90) | ||
forward (100) | ||
left (90) | ||
forward (100) | ||
left (90) | ||
|
||
penup() | ||
forward (100) | ||
goto (200,0) | ||
pendown() | ||
|
||
|
||
forward (100) | ||
left (90) | ||
forward (100) | ||
left (90) | ||
forward (100) | ||
left (90) | ||
forward (100) | ||
left (90) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from turtle import * | ||
|
||
forward (100) | ||
left (120) | ||
forward (100) | ||
left (120) | ||
forward (100) | ||
left (120) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from turtle import * | ||
|
||
fillcolor("red") | ||
begin_fill() | ||
forward (100) | ||
left (120) | ||
forward (100) | ||
left (120) | ||
forward (100) | ||
left (120) | ||
end_fill() | ||
|
||
penup() | ||
forward (0) | ||
goto (0,-100) | ||
pendown() | ||
|
||
fillcolor("yellow") | ||
begin_fill() | ||
forward (100) | ||
left (90) | ||
forward (100) | ||
left (90) | ||
forward (100) | ||
left (90) | ||
forward (100) | ||
left (90) | ||
end_fill() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from turtle import * | ||
|
||
fillcolor("orange") | ||
begin_fill() | ||
forward (100) | ||
left (60) | ||
forward (100) | ||
left (60) | ||
forward (100) | ||
left (60) | ||
forward (100) | ||
left (60) | ||
forward (100) | ||
left (60) | ||
forward (100) | ||
left (60) | ||
end_fill() | ||
|
||
penup() | ||
forward (0) | ||
goto (10,15) | ||
pendown() | ||
|
||
fillcolor("green") | ||
begin_fill() | ||
forward (80) | ||
left (60) | ||
forward (80) | ||
left (60) | ||
forward (80) | ||
left (60) | ||
forward (80) | ||
left (60) | ||
forward (80) | ||
left (60) | ||
forward (80) | ||
left (60) | ||
end_fill() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from random import randint | ||
|
||
name = input("What is your name? ") | ||
random_num = randint(int (1), int (100)) | ||
|
||
print("Hello "+name+", your lucky number is "+str(random_num)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from random import randint | ||
|
||
name = input("What is your name? ") | ||
|
||
birth_year = int(input("What is your year of birth? ")) | ||
|
||
random_num = randint(int (0), int (70)) | ||
|
||
addition= birth_year + random_num | ||
|
||
print("Hello "+name+", your lucky year is "+str(addition)) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name = input("What is your name? ") | ||
print("Hello " + name + ", COMP1753 module leader") | ||
|
||
print() | ||
input("Press return to continue ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
def input_and_convert(prompt, conversion_fn): | ||
string = input(prompt) | ||
number = conversion_fn(string) | ||
return number | ||
|
||
def calculate(number1, number2, operation): | ||
if operation == "+": | ||
combination = number1 + number2 | ||
elif operation == "-": | ||
combination = number1 - number2 | ||
elif operation == "*": | ||
combination = number1 * number2 | ||
elif operation == "/": | ||
combination = number1 / number2 | ||
else: | ||
combination = "ERROR ... '" + operation + "' unrecognised" | ||
return combination | ||
|
||
def output(parameter1, parameter2): | ||
parameter1_str = str(parameter1) | ||
parameter2_str = str(parameter2) | ||
print(parameter1_str + parameter2_str) | ||
|
||
number1 = input_and_convert("First number: ", int) | ||
|
||
number2 = input_and_convert("Second number: ", int) | ||
|
||
operation = input_and_convert("Operation [+, -, *, /]: ", str) | ||
|
||
combination = calculate(number1, number2, operation) | ||
|
||
output("Answer: ", combination) | ||
|
||
print() | ||
input("Press return to continue ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
first_name = input("What is your first name? ") | ||
last_name = input("What is your last name? ") | ||
print("Hello " + first_name + " " + last_name + ", COMP1753 module leader") | ||
|
||
print() | ||
input("Press return to continue ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
def input_and_convert(prompt, conversion_fn): | ||
string = input(prompt) | ||
number = conversion_fn(string) | ||
return number | ||
|
||
|
||
def calculate(number1, number2, operation): | ||
if operation == "+": | ||
combination = number1 + number2 | ||
elif operation == "-": | ||
combination = number1 - number2 | ||
return combination | ||
|
||
|
||
def output(parameter1, parameter2): | ||
parameter1_str = str(parameter1) | ||
parameter2_str = str(parameter2) | ||
print(parameter1_str + parameter2_str) | ||
|
||
|
||
number1 = input_and_convert(" First number: ", int) | ||
|
||
number2 = input_and_convert("Second number: ", int) | ||
|
||
operation = input_and_convert("Operation [+, -]: ", str) | ||
|
||
combination = calculate(number1, number2, operation) | ||
|
||
output("Answer: ", combination) | ||
|
||
print() | ||
input("Press return to continue ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
def input_and_convert(prompt, conversion_fn): | ||
string = input(prompt) | ||
number = conversion_fn(string) | ||
return number | ||
|
||
|
||
def calculate(number1, number2, operation): | ||
if operation == "+": | ||
combination = number1 + number2 | ||
elif operation == "-": | ||
combination = number1 - number2 | ||
return combination | ||
|
||
|
||
def output(parameter1, parameter2): | ||
parameter1_str = str(parameter1) | ||
parameter2_str = str(parameter2) | ||
print(parameter1_str + parameter2_str) | ||
|
||
|
||
number1 = input_and_convert(" First number: ", int) | ||
|
||
number2 = input_and_convert("Second number: ", int) | ||
|
||
operation = input_and_convert("Operation [+, -]: ", str) | ||
|
||
combination = calculate(number1, number2, operation) | ||
|
||
output("Answer: ", combination) | ||
|
||
print() | ||
input("Press return to continue ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
def input_and_convert(prompt, conversion_fn): | ||
string = input(prompt) | ||
number = conversion_fn(string) | ||
return number | ||
|
||
|
||
def calculate(number1, number2, number3, operation): | ||
if operation == "+": | ||
combination = number1 + number2 + number3 | ||
elif operation == "-": | ||
combination = number1 - number2 - number3 | ||
return combination | ||
|
||
|
||
def output(parameter1, parameter2): | ||
parameter1_str = str(parameter1) | ||
parameter2_str = str(parameter2) | ||
print(parameter1_str + parameter2_str) | ||
|
||
|
||
number1 = input_and_convert(" First number: ", int) | ||
|
||
number2 = input_and_convert("Second number: ", int) | ||
|
||
number3 = input_and_convert(" Third number: ", int) | ||
|
||
operation = input_and_convert("Operation [+, -]: ", str) | ||
|
||
combination = calculate(number1, number2, number3, operation) | ||
|
||
output("Answer: ", combination) | ||
|
||
print() | ||
input("Press return to continue ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
def input_and_convert(prompt, conversion_fn): | ||
string = input(prompt) | ||
number = conversion_fn(string) | ||
return number | ||
|
||
|
||
def calculate(number1, number2, operation): | ||
if operation == "+": | ||
combination = number1 + number2 | ||
elif operation == "-": | ||
combination = number1 - number2 | ||
return combination | ||
|
||
|
||
def output(parameter1, parameter2): | ||
parameter1_str = str(parameter1) | ||
parameter2_str = str(parameter2) | ||
print(parameter1_str + parameter2_str) | ||
|
||
|
||
number1 = input_and_convert(" First number: ", int) | ||
|
||
number2 = input_and_convert("Second number: ", int) | ||
|
||
operation = input_and_convert("Operation [+, -]: ", str) | ||
|
||
combination = calculate(number1, number2, operation) | ||
|
||
output("Answer: ", combination) | ||
|
||
print() | ||
input("Press return to continue ...") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
def input_and_convert(prompt, conversion_fn): | ||
string = input(prompt) | ||
number = conversion_fn(string) | ||
return number | ||
|
||
|
||
def calculate(number1, number2, operation): | ||
if operation == "+": | ||
combination = number1 + number2 | ||
elif operation == "-": | ||
combination = number1 - number2 | ||
return combination | ||
|
||
|
||
def output(parameter1, parameter2): | ||
parameter1_str = str(parameter1) | ||
parameter2_str = str(parameter2) | ||
print(parameter1_str + parameter2_str) | ||
|
||
|
||
number1 = input_and_convert(" First number: ", int) | ||
|
||
number2 = input_and_convert("Second number: ", int) | ||
|
||
operation = input_and_convert("Operation [+, -]: ", str) | ||
|
||
combination = calculate(number1, number2, operation) | ||
|
||
output("Answer: ", combination) | ||
|
||
print() | ||
input("Press return to continue ...") |
Oops, something went wrong.