@ -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.
|
@ -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="")
|
@ -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)
|
||||
|
||||
|
@ -0,0 +1,64 @@
|
||||
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")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
from random import randint
|
||||
#Challenges5
|
||||
|
||||
number_one = randint(1,10)
|
||||
number_two = randint(1,10)
|
||||
answer = int(input(f"What is {number_one} times {number_two} ?\n" * 2))
|
||||
if number_one * number_two == answer:
|
||||
print(f"Your answer {answer} is correct!!")
|
||||
else:
|
||||
print(f"Wrong the correct answer is {number_one * number_two}")
|
@ -0,0 +1,5 @@
|
||||
userInput = int(input("Enter a valid number :"))
|
||||
if userInput > 100:
|
||||
print(" Great number ")
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
userInput = int(input("Enter a valid number :"))
|
||||
if userInput == 100:
|
||||
print(" Tie ")
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
from random import randint
|
||||
#Challenges5
|
||||
|
||||
number_one = randint(1,10)
|
||||
number_two = randint(1,10)
|
||||
answer = int(input(f"What is {number_one} times {number_two} ?\n"))
|
||||
if number_one * number_two == answer:
|
||||
print("yes")
|
||||
else:
|
||||
print("No!!")
|
@ -0,0 +1,12 @@
|
||||
from random import randint
|
||||
#Challenge 9
|
||||
|
||||
win1 = randint(1,10)
|
||||
win2 = randint(11,20)
|
||||
win3 = randint(21,30)
|
||||
|
||||
winners = str(win1) + " " + str(win2) + " " + str(win3)
|
||||
print(winners)
|
||||
for winner in winners:
|
||||
print(winner)
|
||||
|
@ -0,0 +1,16 @@
|
||||
from gasp import *
|
||||
#The below link will give you a total understanding of Coordinate Plan
|
||||
# https://www.splashlearn.com/math-vocabulary/geometry/coordinates
|
||||
|
||||
begin_graphics()
|
||||
|
||||
|
||||
Circle((300, 350), 90)#This cirecle represent head
|
||||
Circle((350, 370), 15) #This circle represent left eye
|
||||
Circle((250, 370), 15) #This circle represent left eye
|
||||
Arc((300, 350), 40, 225, 330)
|
||||
Line((300, 400), (230, 250))
|
||||
|
||||
update_when("key_pressed")
|
||||
|
||||
end_graphics()
|
@ -0,0 +1,20 @@
|
||||
from gasp import *
|
||||
begin_graphics()
|
||||
|
||||
|
||||
Circle((300, 200), 100)
|
||||
Circle((240, 240), 15)
|
||||
Circle((360, 240), 15)
|
||||
Line((500, 300), (400,220))
|
||||
Line((380, 260), (330,260))
|
||||
Line((270, 260), (220,260))
|
||||
Line((300, 260), (270, 200))
|
||||
Line((300, 260), (340, 200))
|
||||
Line((340, 200), (270, 200))
|
||||
Arc((300, 190), 40, 225, 315)
|
||||
Arc((420, 220), 30, 235, 510)
|
||||
Arc((200, 220), 30, 60, 630)
|
||||
|
||||
|
||||
update_when('key_passed')
|
||||
end_graphics()
|
@ -0,0 +1,12 @@
|
||||
#Challenges 3
|
||||
def moan():
|
||||
print("\nPython is useless!\n\nAnd so are these worksheets\n")
|
||||
|
||||
moan()
|
||||
|
||||
# Challenge 4
|
||||
|
||||
def twice(x):
|
||||
print(x*x)
|
||||
|
||||
twice(5)
|
@ -0,0 +1,6 @@
|
||||
Question
|
||||
Base on your instruction in the lesson to draw a face with the following:
|
||||
head, eyes, nose and mouth
|
||||
I tried doing so but got lose on the line. can you please explain what these
|
||||
value represent in a (Line((300, 400), (230, 250))? Example for a Circle value (x=350,y=370) and 15 is equal to how big you
|
||||
want the circle to be...
|
@ -0,0 +1,4 @@
|
||||
#Challenges1 Question
|
||||
<p>According to your instruction or recommendation for one to understand coordinator and draw picture/pixel in python you need to understand the coordinate plan which happened to be the x and y axis. So yesterday I search this site https://www.splashlearn.com/math-vocabulary/geometry/coordinates and understand that the coordinate have four quadrants. quadrant i(+,+) quadrantii(-,+) quadrant iii (-,-) and quadrant iv(+,-) and origin is at the center (0). Forward more when a value like this Circle((350,255),100) which has three value. The first value 350 represent positive x, the second value represent positive y while the last value tell you how big the circle will be on a coordinate. My second Circle that represent the eye have similar step. first value represent the eye.Circle((x=300,y255), "how big the first eye is 20) #This circle represent left eye and it is situated in the first quadrant i(+,+)</p> and same for the second eye in my code.Now my response to drawing a nose will come after I under this https://www.splashlearn.com/math-vocabulary/geometry/line.
|
||||
|
||||
Hope this find you well.
|
Loading…
Reference in New Issue