Skip to content

Instantly share code, notes, and snippets.

View Hayyhayy's full-sized avatar
🎯
Focusing

Hayyhayy

🎯
Focusing
View GitHub Profile
@Hayyhayy
Hayyhayy / ex05infiniteloop.py
Last active March 14, 2020 08:25
1. In python terms, the variable friends is a list of three strings, 2. the for loop goes through the list and executes the body once for each of the three strings in the list resulting in thiis output. 3. **for** and **in** are reserved Python keywo
n = 10
while True:
Print(n, end=' ')
n = n - 1
print('Done!')
@Hayyhayy
Hayyhayy / ex05infiniteloop.py
Last active March 14, 2020 08:17
While n is greater than 0, display the value of n and then reduce the value of n by 1. When you get to 0, exit the statement and display the word Blastoff!
n = 10
while True:
Print(n, end=' ')
n = n - 1
print('Done!')
@Hayyhayy
Hayyhayy / ex05.py
Created March 14, 2020 06:31
[while] statement #while #loops
n = 5
while n > 0:
print(n)
n = n - 1
print('Blastoff!')
@Hayyhayy
Hayyhayy / Assignment4.6.py
Last active March 10, 2020 16:27
Put the logic to do the computation of time-and-a-half in a function called computepay() and use the function to do the computation. The function should return a value. #function #return
def computepay(h,r):
if h < 40:
Pay = h * r
else:
Pay = 40 * r + (h-40) * 1.5 * r
return Pay
hrs = input("Enter Hours:")
h = float(hrs)
rate = input("Enter Rate:")