diff --git a/Week-1/Week-1.md b/Week-1/Week-1.md new file mode 100644 index 0000000..b3eb684 --- /dev/null +++ b/Week-1/Week-1.md @@ -0,0 +1,4 @@ +## What happens when you put an expression on a line without a print command in a python script? +### As mentioned earlier on print command are use to display information when a python program is being written in a script file. No it will not print. +## What does putting a comma at the end of a print command do? In python putting comma keep string on the same line without creating a newline. +## What does putting a print command on a line by itself doe? In python print statment are intended to print out information on the screen so having a print statement without an expression the print statement will display a empty or blank output. diff --git a/Week-1/firstpro.py b/Week-1/firstpro.py new file mode 100644 index 0000000..2fdb3c6 --- /dev/null +++ b/Week-1/firstpro.py @@ -0,0 +1,14 @@ +print("Experiment 1: ") +1 + 8 +print(1 + 2) +"How come this did not print?" +print("but this did?") +print() +print() + +print("Experiment 2:") +for number in 2, 4, 6: + print(2 * number) + +for number in 2, 4, 6: + print(3 * number, end="") diff --git a/Week-1/mathquiz.py b/Week-1/mathquiz.py new file mode 100644 index 0000000..d7e8f2c --- /dev/null +++ b/Week-1/mathquiz.py @@ -0,0 +1,19 @@ + +from random import randint + +#Challenges3 +number_one = randint(1,10) +number_two = randint(1,10) +answer = int(input(f"What is {number_one} time {number_two} ?\n")) +if (number_one * number_two == answer): + print("correct") +else: + print("wrong") + +#Challenge 4 +number_one = randint(1,10) +for number in range(number_one): + if number >= 5: + print(number) + + diff --git a/Week-2/mathquiz.py b/Week-2/mathquiz.py new file mode 100644 index 0000000..b4c4e45 --- /dev/null +++ b/Week-2/mathquiz.py @@ -0,0 +1,40 @@ +from random import randint +#Challenge1 + +number_one = randint(1,10) +number_two = randint(1,10) +print(f"Challenge one\nWhat is {number_one} times {number_two}") +answer = number_one * number_two +print(answer) + +#Challenge2 +number_one = randint(1,10) +number_two = randint(1,10) +print(f"Challenge two\nWhat is {number_one} plus {number_two}") + +result = number_one + number_two +print(result) + + +#Challenges3 + +number_one = randint(1,10) +number_two = randint(1,10) +answer = int(input(f"Challenge three\nWhat is {number_one} times {number_two} ?\n")) + + +#Challenge4 +number_one = randint (1,10) +print(str(number_one) * 5) + +#Challenges5 + +number_one = randint(1,10) +number_two = randint(1,10) +answer = int(input(f"Challenge five\nWhat is {number_one} times {number_two} ?\n")) +if number_one * number_two == answer: + print(f"Your answer {answer} is correct!!") +else: + print(f"Wrong") + +