Python

Discussion in 'Programming/Html' started by Ghosty, Apr 1, 2020.

  1. Ghosty

    Ghosty Ancient Guru

    Messages:
    7,988
    Likes Received:
    1,192
    GPU:
    RTX 3050
    Anyone good with Python?

    how do I loop back to the top of the program after an IF or ELIF statement using True or False statements?
     
  2. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,606
    Likes Received:
    13,615
    GPU:
    GF RTX 4070
    Code:
    while True:
       - your stuff -
       if - some condition -:
          break
    
    Infinite loop with exit (break) on condition.
    I am not an expert on Python, but according to online tutorials that is a common approach.

    https://wiki.python.org/moin/WhileLoop
     
  3. Ghosty

    Ghosty Ancient Guru

    Messages:
    7,988
    Likes Received:
    1,192
    GPU:
    RTX 3050
    Yeah, the continue and break commands work ok to stop an infinite loop. I was just wondering if it was possible by another appoach. Thanks.
     
  4. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,606
    Likes Received:
    13,615
    GPU:
    GF RTX 4070

  5. Ghosty

    Ghosty Ancient Guru

    Messages:
    7,988
    Likes Received:
    1,192
    GPU:
    RTX 3050
    Hmmm. The Len() function is used to call numbers. I'll try and figure it out. I'm pretty new to python so it might be something I'll learn later on.
     
  6. slick3

    slick3 Guest

    Messages:
    1,867
    Likes Received:
    234
    GPU:
    RTX 2070 +85/1200
    I am also a complete newbie in Python - what resources are you using to learn?
     
  7. Ghosty

    Ghosty Ancient Guru

    Messages:
    7,988
    Likes Received:
    1,192
    GPU:
    RTX 3050
    Python.org website. Plus a couple of books.
     
  8. anticupidon

    anticupidon Ancient Guru

    Messages:
    7,898
    Likes Received:
    4,149
    GPU:
    Polaris/Vega/Navi
    Hmm, I might start to learn this as well. Best way to kill time, to say so.
     
  9. Ghosty

    Ghosty Ancient Guru

    Messages:
    7,988
    Likes Received:
    1,192
    GPU:
    RTX 3050
    I'm mainly learning it as it's an easy language to start off with. I'll probably move towards C++ at some point.
     
  10. Ghosty

    Ghosty Ancient Guru

    Messages:
    7,988
    Likes Received:
    1,192
    GPU:
    RTX 3050
    I figured it out. Using def() function.
     

  11. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,606
    Likes Received:
    13,615
    GPU:
    GF RTX 4070
    I was in C/C++ (witnessed a C++ birth) for 18 professional years, then I was attached to new project using C# - and since then I don`t want to go back to C++.
     
  12. Ghosty

    Ghosty Ancient Guru

    Messages:
    7,988
    Likes Received:
    1,192
    GPU:
    RTX 3050
    Doesn't C++ give you more control over memory management? From what I've seen C++ is more for large scale projects as it's time consuming to code.

    I'm enjoying Python so far. I find it sticks in my memory without too much practice.
     
  13. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,606
    Likes Received:
    13,615
    GPU:
    GF RTX 4070
    It gives, but if you will do tricks with memory you can get hard to fix bugs. You don`t have to struggle with memory, you have to struggle with the task. But memory difference is a little thing, I prefer the syntax and implementation of "environment" (libraries, frameworks) in C# (and in .Net Framework overall).

    As for the size of projects and of time consumption, you rarely write whole code from scratch, and usually you use patterns established in the industry. Modern C++ has all features of C# now, but the syntax and implementation details are sometimes awkward and non-intuitive.

    PS In my eyes C# is more simple for the study, hence it would be more logical to study more simple language first and then study less simple one.
     
  14. Ghosty

    Ghosty Ancient Guru

    Messages:
    7,988
    Likes Received:
    1,192
    GPU:
    RTX 3050
    Thanks. I'll look in to c# at some point.
     
  15. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,606
    Likes Received:
    13,615
    GPU:
    GF RTX 4070
    Also I would recommend to look into PowerShell - it is deployed with Windows, it is based on .Net Framework (and has direct access to all classes), it is script language, it has thousands of commandlets (a term) at your disposal - very useful for automation in Windows.
     

  16. Ghosty

    Ghosty Ancient Guru

    Messages:
    7,988
    Likes Received:
    1,192
    GPU:
    RTX 3050
    I had a look at Visual studio. But found it a bit clunky. But some business use it. I've used Arch Linux in the past but couldn't get use to it. I guess I have been using Windows for too long. Python was easier to use in Linux though.
     
  17. mbk1969

    mbk1969 Ancient Guru

    Messages:
    15,606
    Likes Received:
    13,615
    GPU:
    GF RTX 4070
    I work in Visual Studio since 2000 (now it is 4th work place since then - all companies were using VS), it is superb IDE (feels like home). I am sure there are IDEs for all Operating Systems, but some Linux people like to use command line approach with make-files - this is ancient crap.
     
  18. Ghosty

    Ghosty Ancient Guru

    Messages:
    7,988
    Likes Received:
    1,192
    GPU:
    RTX 3050
    I'm currently learning how abstraction and encapsulation works.
     
  19. Ghosty

    Ghosty Ancient Guru

    Messages:
    7,988
    Likes Received:
    1,192
    GPU:
    RTX 3050
    It's not no. It gets even more complexed with OOP. NASA uses it. So it might be the reason why.
     
    Last edited: Apr 23, 2020
  20. Webhiker

    Webhiker Master Guru

    Messages:
    751
    Likes Received:
    264
    GPU:
    ASRock Radeon RX 79

Share This Page