A Cool Python Mini App
Here's a small program that I made in Python. The code was inspired from Mike Dane. (He's really good, go check him out too at MikeDane.com) My program allows the user to replace a letter to another specific one in a given sentence..
Please do upvote and check out some of my other cool stuff..
It works as intended but I have some comments about your code style (I just mean help so please do not take offence):
1. You have no comments in your code.
2. You have 3 variables defined in global scope.
3. You have code repetition (3 input statements).
4. You do not have a main function.
5. You are using quite nested loop.
6. The following code section can be formatted with less redundant code:
if letter.isupper(): translation = translation + change else: translation = translation + change else: translation = translation + letter``` If you want, you can look at the same program I write differently. Keep coding! cheers :)
@Foster_Bryant Not as it is, but If you want to develop further and may be import this file into some other program, or make small modules part of a big program later etc. then you're gonna realise that you will need it. However, it's a choice of a developer, I think It's a good practice to run the functions inside the main function, some programming language enforce it strictly, Python does not. Still, I think it's a good practice.
You know, it would be a good idea to add comments (like I do in my programs) and maybe put the whole thing in a function, so that it can be run at intervals if required (or you could add a while loop at the start)
But yeah, that's a real cool program
- from a fellow py3 coder
A nice thing to add would be a loop, using while True or a for loop, just so you don't have to re-run the program for each new sentence.