Skip to main content
Code Review

Return to Question

Commonmark migration
Source Link

I have accomplished what I wanted to do but I think this can be done better. I want my code to look professional.

What my code does is ask for your name and gives output in below form.

Input: Jack

Output: j = joyful a = awesome c = curious k = kindhearted

Please show me how to code in a professional manner by reviewing the below code.

#!/usr/bin/env python
import sys
import string
names = {
'a': 'awesome',
'b': 'bold',
'c': 'curious',
'd':'delightful',
'e':'emotional',
'f':'fearless',
'g':'gifted',
'h':'helpful',
'i':'imaginary',
'j':'joyful',
'k':'kindhearted',
'l':'lovable',
'm':'memorable',
'n':'naughty',
'o':'open',
'p':'playful',
'q':'quarrelsome',
'r':'reliable',
's':'serious',
't':'thoughtful',
'u':'unique',
'v':'victorious',
'w':'wise',
'x':'xerox copy',
'y':'yummy',
'z':'zealous'
}
def main():
 i=j=0
 user = raw_input("What is your name?: ")
 print ""
 while i<len(user):
 while j<len(names):
 if user[i]==names.keys()[j]:
 print " " + user[i] + ' = ' + names.values()[j]
 j=j+1
 while j!=0:
 j=0 
 i=i+1
if __name__ == '__main__':
 main()

I have accomplished what I wanted to do but I think this can be done better. I want my code to look professional.

What my code does is ask for your name and gives output in below form.

Input: Jack

Output: j = joyful a = awesome c = curious k = kindhearted

Please show me how to code in a professional manner by reviewing the below code.

#!/usr/bin/env python
import sys
import string
names = {
'a': 'awesome',
'b': 'bold',
'c': 'curious',
'd':'delightful',
'e':'emotional',
'f':'fearless',
'g':'gifted',
'h':'helpful',
'i':'imaginary',
'j':'joyful',
'k':'kindhearted',
'l':'lovable',
'm':'memorable',
'n':'naughty',
'o':'open',
'p':'playful',
'q':'quarrelsome',
'r':'reliable',
's':'serious',
't':'thoughtful',
'u':'unique',
'v':'victorious',
'w':'wise',
'x':'xerox copy',
'y':'yummy',
'z':'zealous'
}
def main():
 i=j=0
 user = raw_input("What is your name?: ")
 print ""
 while i<len(user):
 while j<len(names):
 if user[i]==names.keys()[j]:
 print " " + user[i] + ' = ' + names.values()[j]
 j=j+1
 while j!=0:
 j=0 
 i=i+1
if __name__ == '__main__':
 main()

I have accomplished what I wanted to do but I think this can be done better. I want my code to look professional.

What my code does is ask for your name and gives output in below form.

Input: Jack

Output: j = joyful a = awesome c = curious k = kindhearted

Please show me how to code in a professional manner by reviewing the below code.

#!/usr/bin/env python
import sys
import string
names = {
'a': 'awesome',
'b': 'bold',
'c': 'curious',
'd':'delightful',
'e':'emotional',
'f':'fearless',
'g':'gifted',
'h':'helpful',
'i':'imaginary',
'j':'joyful',
'k':'kindhearted',
'l':'lovable',
'm':'memorable',
'n':'naughty',
'o':'open',
'p':'playful',
'q':'quarrelsome',
'r':'reliable',
's':'serious',
't':'thoughtful',
'u':'unique',
'v':'victorious',
'w':'wise',
'x':'xerox copy',
'y':'yummy',
'z':'zealous'
}
def main():
 i=j=0
 user = raw_input("What is your name?: ")
 print ""
 while i<len(user):
 while j<len(names):
 if user[i]==names.keys()[j]:
 print " " + user[i] + ' = ' + names.values()[j]
 j=j+1
 while j!=0:
 j=0 
 i=i+1
if __name__ == '__main__':
 main()
changed some wording and added an explanation
Source Link
Malachi
  • 29k
  • 11
  • 86
  • 188

I have accomplished what I wanted to do but I think this is the best way to do thiscan be done better. I want tomy code like ato look professional.

What my code does is ask for your name and gives output in below form.

Input: Jack

Output: j = joyful a = awesome c = curious k = kindhearted

Please show me how to do codingcode in a professional way and reviewmanner by reviewing the below code.

#!/usr/bin/env python
import sys
import string
names = {
'a': 'awesome',
'b': 'bold',
'c': 'curious',
'd':'delightful',
'e':'emotional',
'f':'fearless',
'g':'gifted',
'h':'helpful',
'i':'imaginary',
'j':'joyful',
'k':'kindhearted',
'l':'lovable',
'm':'memorable',
'n':'naughty',
'o':'open',
'p':'playful',
'q':'quarrelsome',
'r':'reliable',
's':'serious',
't':'thoughtful',
'u':'unique',
'v':'victorious',
'w':'wise',
'x':'xerox copy',
'y':'yummy',
'z':'zealous'
}
def main():
 i=j=0
 user = raw_input("What is your name?: ")
 print ""
 while i<len(user):
 while j<len(names):
 if user[i]==names.keys()[j]:
 print " " + user[i] + ' = ' + names.values()[j]
 j=j+1
 while j!=0:
 j=0 
 i=i+1
if __name__ == '__main__':
 main()

I have accomplished what I wanted to do but I think this is the best way to do this. I want to code like a professional. Please show me how to do coding in a professional way and review the below code.

#!/usr/bin/env python
import sys
import string
names = {
'a': 'awesome',
'b': 'bold',
'c': 'curious',
'd':'delightful',
'e':'emotional',
'f':'fearless',
'g':'gifted',
'h':'helpful',
'i':'imaginary',
'j':'joyful',
'k':'kindhearted',
'l':'lovable',
'm':'memorable',
'n':'naughty',
'o':'open',
'p':'playful',
'q':'quarrelsome',
'r':'reliable',
's':'serious',
't':'thoughtful',
'u':'unique',
'v':'victorious',
'w':'wise',
'x':'xerox copy',
'y':'yummy',
'z':'zealous'
}
def main():
 i=j=0
 user = raw_input("What is your name?: ")
 print ""
 while i<len(user):
 while j<len(names):
 if user[i]==names.keys()[j]:
 print " " + user[i] + ' = ' + names.values()[j]
 j=j+1
 while j!=0:
 j=0 
 i=i+1
if __name__ == '__main__':
 main()

I have accomplished what I wanted to do but I think this can be done better. I want my code to look professional.

What my code does is ask for your name and gives output in below form.

Input: Jack

Output: j = joyful a = awesome c = curious k = kindhearted

Please show me how to code in a professional manner by reviewing the below code.

#!/usr/bin/env python
import sys
import string
names = {
'a': 'awesome',
'b': 'bold',
'c': 'curious',
'd':'delightful',
'e':'emotional',
'f':'fearless',
'g':'gifted',
'h':'helpful',
'i':'imaginary',
'j':'joyful',
'k':'kindhearted',
'l':'lovable',
'm':'memorable',
'n':'naughty',
'o':'open',
'p':'playful',
'q':'quarrelsome',
'r':'reliable',
's':'serious',
't':'thoughtful',
'u':'unique',
'v':'victorious',
'w':'wise',
'x':'xerox copy',
'y':'yummy',
'z':'zealous'
}
def main():
 i=j=0
 user = raw_input("What is your name?: ")
 print ""
 while i<len(user):
 while j<len(names):
 if user[i]==names.keys()[j]:
 print " " + user[i] + ' = ' + names.values()[j]
 j=j+1
 while j!=0:
 j=0 
 i=i+1
if __name__ == '__main__':
 main()
deleted 27 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

I am noob in python and try to code. I have accomplished what I wanted to do but I think this is the best way to do this. I want to code like a professional. Please show me how to do coding in a professional way and review the below code.

#!/usr/bin/env python
import sys
import string
names = {
'a': 'awesome',
'b': 'bold',
'c': 'curious',
'd':'delightful',
'e':'emotional',
'f':'fearless',
'g':'gifted',
'h':'helpful',
'i':'imaginary',
'j':'joyful',
'k':'kindhearted',
'l':'lovable',
'm':'memorable',
'n':'naughty',
'o':'open',
'p':'playful',
'q':'quarrelsome',
'r':'reliable',
's':'serious',
't':'thoughtful',
'u':'unique',
'v':'victorious',
'w':'wise',
'x':'xerox copy',
'y':'yummy',
'z':'zealous'
}
def main():
 i=j=0
 user = raw_input("What is your name?: ")
 print ""
 while i<len(user):
 while j<len(names):
 if user[i]==names.keys()[j]:
 print " " + user[i] + ' = ' + names.values()[j]
 j=j+1
 while j!=0:
 j=0 
 i=i+1
if __name__ == '__main__':
 main()

I am noob in python and try to code. I have accomplished what I wanted to do but I think this is the best way to do this. I want to code like professional. Please show me to do coding in professional way and review below code.

#!/usr/bin/env python
import sys
import string
names = {
'a': 'awesome',
'b': 'bold',
'c': 'curious',
'd':'delightful',
'e':'emotional',
'f':'fearless',
'g':'gifted',
'h':'helpful',
'i':'imaginary',
'j':'joyful',
'k':'kindhearted',
'l':'lovable',
'm':'memorable',
'n':'naughty',
'o':'open',
'p':'playful',
'q':'quarrelsome',
'r':'reliable',
's':'serious',
't':'thoughtful',
'u':'unique',
'v':'victorious',
'w':'wise',
'x':'xerox copy',
'y':'yummy',
'z':'zealous'
}
def main():
 i=j=0
 user = raw_input("What is your name?: ")
 print ""
 while i<len(user):
 while j<len(names):
 if user[i]==names.keys()[j]:
 print " " + user[i] + ' = ' + names.values()[j]
 j=j+1
 while j!=0:
 j=0 
 i=i+1
if __name__ == '__main__':
 main()

I have accomplished what I wanted to do but I think this is the best way to do this. I want to code like a professional. Please show me how to do coding in a professional way and review the below code.

#!/usr/bin/env python
import sys
import string
names = {
'a': 'awesome',
'b': 'bold',
'c': 'curious',
'd':'delightful',
'e':'emotional',
'f':'fearless',
'g':'gifted',
'h':'helpful',
'i':'imaginary',
'j':'joyful',
'k':'kindhearted',
'l':'lovable',
'm':'memorable',
'n':'naughty',
'o':'open',
'p':'playful',
'q':'quarrelsome',
'r':'reliable',
's':'serious',
't':'thoughtful',
'u':'unique',
'v':'victorious',
'w':'wise',
'x':'xerox copy',
'y':'yummy',
'z':'zealous'
}
def main():
 i=j=0
 user = raw_input("What is your name?: ")
 print ""
 while i<len(user):
 while j<len(names):
 if user[i]==names.keys()[j]:
 print " " + user[i] + ' = ' + names.values()[j]
 j=j+1
 while j!=0:
 j=0 
 i=i+1
if __name__ == '__main__':
 main()
edited tags; edited title
Link
200_success
  • 145.5k
  • 22
  • 190
  • 478
Loading
deleted 49 characters in body
Source Link
SylvainD
  • 29.7k
  • 1
  • 49
  • 93
Loading
Source Link
Loading
lang-py

AltStyle によって変換されたページ (->オリジナル) /