You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
981 B
Python
45 lines
981 B
Python
import time
|
|
|
|
from gasp import *
|
|
from random import randint
|
|
|
|
'''Challenge write the following program
|
|
in a file named firstprog.py'''
|
|
|
|
print("Experiment 1; ")
|
|
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="")
|
|
|
|
'''When you place an expression on a line in python script without the print
|
|
function that expression will not get excute.
|
|
Putting comma " , " at the end stop the print function from creating a newline.
|
|
|
|
So far so good in this first lecture on introduction to Python which is a programming
|
|
language I learn that print is a build in function that is use to display output
|
|
to the user'''
|
|
|
|
begin_graphics()
|
|
|
|
Line((100,100), (200, 200))
|
|
Circle((320, 240), 40)
|
|
Box((400, 300), 100, 85)
|
|
|
|
update_when("key_pressed")
|
|
end_graphic()
|
|
|
|
randint(10,15)
|
|
|
|
|
|
time.strftime("%A, %d %B %Y, at %I:%M%p", time.localtime(time.time()))
|
|
print(time)
|