Monday, October 17, 2016

Random Python Programs 2: October 17 2016

Program Let's You Set The Parameter to Count To A Certain Number, From A Certain Number
numbera=int(input("Type in the Number you Want to Count From: "))
numberb=int(input("Type in the Number you Want to Count To: "))
numberb+=1for counter in range((numbera),(numberb)):
    print(counter)



Program Let's You Set A Number to Countdown From
counter=int(input("Type in the Number you Want to Count Down From: "))
while counter > 0:
    print(counter)
    counter-=1



Program Let's You Set a Number to Count to, and the Rate of Which to Count to it
numberb=int(input("Type in the Number you Want to Count To: "))
numberb +=1numberc=int(input("Type in the Number That Represents What You Want to Count by: "))
for counter in range(0,(numberb),(numberc)):
    print(counter)



Newton's Squareroot Calculator
import math
def my_sqrt(a):
    x = a
    while True:
        y = (x + a/x) /2        if y == x:
            break        x =y
    return y
a=int(input("Type in the Number you Want to Find the Squareroot Of: "))
print ("Python Version: "+(str(math.sqrt(a)))+"  "+"Newton Version: "+ (str(my_sqrt(a))))



Program Let's You Generate A List of Three Items
lista=(input("List Item One: "))
listb=(input("List Item Two: "))
listc=(input("List Item Three: "))
list = [lista,listb,listc]
print(list)



Program Let's You Turn Any Text String, Into a Vertical List
lista=str(input("What String Do You Want to Turn Into A Vertical List?:   "))
for x in lista:
    print(x)

No comments:

Post a Comment