Feedback on My First Python Program: A Projectile Motion Calculator

0
7
Asked By CodeCrafter21 On

I've just created my first program in Python, which is a basic calculator for projectile motion. It calculates the height, flight time, and distance traveled based on the initial velocity, launch angle, and gravitational pull. I've put a lot of effort into it after working through a Python textbook, and I'd love to hear your thoughts on it! I faced some issues with formatting in my original post, so this is the fixed version of my code.

2 Answers

Answered By PhysicsFanatic99 On

Hey, fantastic job on getting a working program out there! As a physics teacher myself, I love seeing projects like this. Just a couple of suggestions: try defining your function `projectile()` outside the loop for better structure. Also, instead of setting the repeat variable to control the loop, consider using `while True:` for a more straightforward way to handle user prompts. It'll make your code cleaner. Keep it up!

Answered By NewbieCoder88 On

Nice work! One thing to consider is improving error handling. It would be helpful to have a dedicated function to ensure user inputs are valid float values. That way, if someone inputs something unexpected, the program won’t crash. Keep coding!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.