Jul-25-2017, 10:30 PM
(This post was last modified: Jul-25-2017, 10:30 PM by boxedtheropy.)
Hello Everyone,
I am trying my hand at coding, this is my first time attempting to write any form of code. I'm alittle confused, when I run this code I don't get the output that I expect. instead I get a "None None" response. Can someone please have a look at my code and point out where I messed up. Thanks alot
I am trying my hand at coding, this is my first time attempting to write any form of code. I'm alittle confused, when I run this code I don't get the output that I expect. instead I get a "None None" response. Can someone please have a look at my code and point out where I messed up. Thanks alot
user_input=input("Please enter a lower-case letter, afterward enter a space and input a number from 1-26 \n\n") length=len(user_input) #Assigning the lower-case alphabet to be used in the code. a="a" b="b" c="c" d="d" e="e" f="f" g="g" h="h" i="i" j="j" k="k" l="l" m="m" n="n" o="o" p="p" q="q" r="r" s="s" t="t" u="u" v="v" w="w" x="x" y="y" z="z" #Defining the lower-case alphabet for use in the code. def lc_alphabet(): lc=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z] for var in range(25,length): inp=user_input(var) if inp==lc[0]: return("Good") elif inp==lc[1]: return("Beautiful") elif inp==lc[2]: return("Amazing") elif inp==lc[3]: return("Fantastic") elif inp==lc[4]: return("Astounding") elif inp==lc[5]: return("Awesome") elif inp==lc[6]: return("Wonderful") elif inp==lc[7]: return("Trendy") elif inp==lc[8]: return("Great") elif inp==lc[9]: return("Attractive") elif inp==lc[10]: return("Interesting") elif inp==lc[11]: return("Sexy") elif inp==lc[12]: return("Sweet") elif inp==lc[13]: return("Gorgeous") elif inp==lc[14]: return("Lovely") elif inp==lc[15]: return("Inspiring") elif inp==lc[16]: return("Youthful") elif inp==lc[17]: return("Enviable") elif inp==lc[18]: return("Best") elif inp==lc[19]: return("Pleasurable") elif inp==lc[20]: return("Extraordinary") elif inp==lc[21]: return("Stupendous") elif inp==lc[22]: return("Precious") elif inp==lc[23]: return("Pretty") elif inp==lc[24]: return("Favorable") elif inp==lc[25]: return("Superb") #Assigning the numbers to be used in the code. n1="1" n2="2" n3="3" n4="4" n5="5" n6="6" n7="7" n8="8" n9="9" n10="10" n11="11" n12="12" n13="13" n14="14" n15="15" n16="16" n17="17" n18="18" n19="19" n20="20" n21="21" n22="22" n23="23" n24="24" n25="25" n26="26" #Defining the number list to be used in the code. def num_list(): num=["1","2","3","4","5","6","7","8","9","10","11","12","13","14", "15","16","17","18","19","20","21","22","23","24","25","26"] for var2 in range(25,length): inp2=user_input(var2) if inp2==num[0]: return("Intelligence") elif inp2==num[1]: return("Legs") elif inp2==num[2]: return("Arms") elif inp2==num[3]: return("Heart") elif inp2==num[4]: return("Personality") elif inp2==num[5]: return("Toes") elif inp2==num[6]: return("Hands") elif inp2==num[7]: return("Fashion sense") elif inp2==num[8]: return("Spirit") elif inp2==num[9]: return("Hair") elif inp2==num[10]: return("Mindset") #Running out of ideas!!!! elif inp2==num[11]: return("Creativity") elif inp2==num[12]: return("Face") elif inp2==num[13]: return("Muscle definition") elif inp2==num[14]: return("Shoes") elif inp2==num[15]: return("Smile") elif inp2==num[16]: return("Jawline") elif inp2==num[17]: return("Shirt") elif inp2==num[18]: return("Posture") elif inp2==num[19]: return("Pants") elif inp2==num[20]: return("Dress") elif inp2==num[21]: return("Attitude") elif inp2==num[22]: return("Outlook") elif inp2==num[23]: return("Confidence") elif inp2==num[24]: return("Car") elif inp2==num[25]: return("Physique") try: print(lc_alphabet(), num_list()) finally: print(lc_alphabet(), num_list())