firstprog.py
parent
9b9828229e
commit
9357b35b44
Binary file not shown.
@ -0,0 +1,36 @@
|
|||||||
|
#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)'''
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
from random import randint
|
||||||
|
number1 = input (str("Enter two number to know it sum\n"))
|
||||||
|
number2 = input (str("\n"))
|
||||||
|
print( int(number1) + int(number2))
|
||||||
|
|
||||||
|
randint (2,16)
|
||||||
|
first_input = input(str("What is 8 time 2"))
|
||||||
|
second_input = input (str(""))
|
||||||
|
print(int (first_input) * int(second_input))
|
||||||
|
|
Loading…
Reference in New Issue