Skip to content

Instantly share code, notes, and snippets.

View amigojapan's full-sized avatar

Usmar A Padow amigojapan

View GitHub Profile
@amigojapan
amigojapan / b.txt
Created February 1, 2013 02:56
test 2
this is test 2 gist
This is test 1 gist
Licensed under the Creative Commons Attribution licence (CC-BY),
either version 4.0 or at your option, any later version. See:
https://creativecommons.org/licenses/by/4.0/
Author:Usmar A. Padow (amigojapan), contact: usmpadow@gmail.com
Written in 2017.
8 Basics of Programming
Licensed under the Creative Commons Attribution licence (CC-BY), either
version 4.0 or at your option, any later version. See:
https://creativecommons.org/licenses/by/4.0/
Author:Usmar A. Padow (amigojapan), contact: usmpadow@gmail.com
Written in 2017.
8 Basics of Programming
import random
def thisIsALie(currentValue,counter,depthToGiveUp):
if(counter==depthToGiveUp):
quit()
if(currentValue):
print("this is not a lie")
else:
print("this is a lie")
currentValue= not currentValue
return thisIsALie(currentValue,counter+1,depthToGiveUp)
## Fundamentals of OOP
##Classes
##A class is like a cookie cutter, it will cut similar cookies for you
##the purpose of classes is mainly to organize data into coherent
##lumps, and sometimes to model the real world
##suppose you are making a game where you have penguins and ducks
##lets see how we can model such a scenario:
import random
## Fundamentals of OOP by amigojapan (Usmar Padow usmpadow@gmail.com ) copyright 2018
##Classes
##A class is like a cookie cutter, it will cut similar cookies for you
##the purpose of classes is mainly to organize data into coherent
##lumps, and sometimes to model the real world
##suppose you are making a game where you have penguins and ducks flying desperately over the ocean
##lets see how we can model such a scenario:
import random
import pyglet
def reverse_string(originalStr):
r=""
for ch in range(len(originalStr),0,-1):
r=r+originalStr[ch-1]
return r
originalStr = input("enter a string:")
print("your string reversed is:"+reverse_string(originalStr))
import random
num=random.randint(1,100)
print("I have chosen a number form 1 to 100, try to guess the number...")
while(True):
user_num=int(input("enter a number:"))
if(user_num==num):
print("you win")
quit()
if(abs(user_num-num)<=5):
print("hot")
import random
while(True):
operator=random.randint(1,4) ##choose operator
A=random.randint(1,10)
B=random.randint(1,10)
if operator==1: ##addition
result=int(input(str(A)+"+"+str(B)+"="))
if result==A+B:
print("correct!")
if operator==2: ##multiplication