Skip to content

Instantly share code, notes, and snippets.

@abhi923
abhi923 / RockPaperScissors-Game.py
Created April 14, 2020 07:08
Game - RockPaperScissors
import random
import sys
print('ROCK, PAPER, SCISSORS')
# These variables keep track of the number of wins, losses, and ties.
wins = 0
losses = 0
ties = 0
@abhi923
abhi923 / magic8ball.py
Created April 15, 2020 06:51
Random8selection
import random
def getAnswer(answerNumber):
if answerNumber == 1:
return 'It is certain'
elif answerNumber == 2:
return 'It is decidedly so'
elif answerNumber == 3:
return 'Yes'
elif answerNumber == 4:
def a():
print('a() starts')
b()
d()
print('a() returns')
def b():
print('b() starts')
c()
import time, sys
indent = 0 # How many spaces to indent.
indentIncreasing = True # Whether the indentation is increasing or not.
try:
while True: # The main program loop.
print(' ' * indent, end='')
print('* ******** *')
time.sleep(0.1) # Pause for 1/10 of a second.
print("Tell me anything...")
anything = input()
print("Hmm...", anything, "... Really?")
leg_a = float(input("Input first leg length: "))
leg_b = float(input("Input second leg length: "))
hypo = (leg_a**2 + leg_b**2) ** .5
print("Hypotenuse length is", round(hypo,2))
print("+" + 10 * "-" + "+")
print(("|" + " " * 10 + "|\n") * 5, end="")
print("+" + 10 * "-" + "+")
# input a float value for variable a here
a = float(input("Value of a: "))
# input a float value for variable b here
b = float(input('Value of B: '))
# output the result of addition here
x = float(input("Enter value for x: "))
# put your code here
y = 1/(x+1/(x+1/(x+1/x)))
print("y =", y)
hour = int(input("Starting time (hours): "))
mins = int(input("Starting time (minutes): "))
dura = int(input("Event duration (minutes): "))
# put your code here
print('Finish Time:', ((hour + (mins+dura)//60)%24), ':', (mins+dura) % 60)