Demo entry 6785301

qsafsaf

   

Submitted by anonymous on Mar 15, 2019 at 00:07
Language: Python 3. Code size: 1.4 kB.

'''AP CS50
Jomi Wuus
Assignment 9
Period 6
January 27 2019
Schenk
'''
def main():
    f = 54.77 #This is a float number
    b = 2 #This is an integer
    name = "Jomi"
    grade = 100 #This is an interger
    print("54.77")
    print("2")
    print("100")
     #Input what number you want to convert
    choice = input("Which number do you want to convert?: ") 



    if choice == "2":
        conv_float= input("Do you want this interger number to be converted to an float number?: ")
        if conv_float == "yes":
            print(float(b)) #Converts variable b to a float
        if conv_float == "no":
            print("Bye")
        exit()

    if choice == "54.77":
        conv_int = input("Do you want this float number to be converted to an interger number?: ")
        if conv_int == "yes":
            print(int(f)) #Converts variable f to int
        if conv_int == "no":
            print("Bye")
        exit()

    if choice == "100":
        conv_string = input("Do you want to convert this number to a string: ")
        if conv_string == "yes":
        #Converts grade variable to a string
            print("Congratulations, "  + name +  "! you scored " + str(grade) + " in test!") 
           
        if conv_string == "no":
            exit()


if (__name__=="__main__"):
    main()

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).