This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this is test 2 gist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is test 1 gist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer