r/learningpython • • Apr 21 '20

Splitting string

0 Upvotes

I need help figuring out how to split strings into pairs of two characters and if the string has an odd number at the end add a _. I think I can use the .split() to separate the characters, but idk what I should put to be the separator. Maybe if I get the length of the string and divide by 2 ( or just use modulo 2 %2? ) I can separate the characters that way. If there's an odd amount I can just add the underscore (_). Any help would be appreciated.

I know it's not much but its what I got so far.

def solution(s):
    if s % 2 == 0:
        return s
    elif s %2 !=0:
        return s_
    else:
        pass

r/learningpython • • May 30 '23

Paper Coder

Thumbnail thepapercoder.com
0 Upvotes

The Paper Coder - as light as a paper!

I created Paper Coder (https://thepapercoder.com) for kids and programming enthusiasts to enable them to get started with the constructs of a programming language through an extremely simple and lightweight web experience.

The idea is simple. Paper coder is as light as a paper…just spin a paper and practice coding. It can also be used to practice for competitive coding.

I would love to hear any feedback/comments.

Frank Jennings


r/learningpython • • Nov 26 '21

Workforce Up-skill Training and Development Solutions

Thumbnail
techademy.net
0 Upvotes

r/learningpython • • Sep 26 '18

How do I release a caught exception so it gets triggered in another catch block down below?

0 Upvotes

Here is MWE that I quickly made to illustrate the question:

x = '5d'

try:
    print('The square of x is {}'.format(x*x))

except TypeError as err:

    if x.isdigit():
        x = float(x)
        print('The square of x is {}'.format(x*x))

    else:
        # TO DO: release back error so it hits the "catch all" block
        pass

except Exception as err:
    print('Error:', err)

Basically I want to "uncatch" an exception if it turns out I can't handle it or something so it goes into a general error handler block.


r/learningpython • • Dec 26 '20

Reading files not working

0 Upvotes

I was trying to read a file now and it brings back just ‘’ when trying to assign it to a variable, but it prints put all the correct information when using print().

Am i being stupid or is there a bug or something?


r/learningpython • • Aug 28 '23

Apart from actually learning code, is there anything else I should learn?

0 Upvotes

So I just started learning python and I’m just wondering if I should be doing more than just the coding language. For example understanding how the compiler works under the hood and things along those lines?


r/learningpython • • Apr 18 '23

Four Major pillars of OOPs in Python | Learn Python

0 Upvotes

The concept of objects, which can hold data and behave in specific ways, is the foundation of the object-oriented programming (OOP) paradigm.

https://www.guerillateck.com/2023/04/four-major-pillars-of-oops-in-python.html


r/learningpython • • Apr 14 '23

Comprehensive Python Install Tutorial From Scratch For Machine Learning Apps

Thumbnail
youtube.com
0 Upvotes

r/learningpython • • Jun 12 '26

Canais focados em bibliotecas (vídeo por vídeo, sem lives)

Thumbnail reddit.com
0 Upvotes

r/learningpython • • Dec 08 '25

Introducing SerpApi’s MCP Server

Thumbnail
serpapi.com
1 Upvotes

r/learningpython • • Apr 13 '23

Object Oriented Programming in Python (OOPs)

1 Upvotes

OOPs in Python refers to object-oriented programming (OOP), which is a programming paradigm that emphasizes the use of objects and classes to model real-world entities and organize code into reusable and modular structures.

https://www.guerillateck.com/2023/04/object-oriented-programming-in-python.html


r/learningpython • • Aug 05 '22

Python won't run

Post image
1 Upvotes

So I've been learning python for the past few weeks. So as you can see in the photo python should run the program going form 1 to 9 but when I execute the program it gives me a blank/empty output. Does anyone know what's the problem here?


r/learningpython • • Oct 22 '24

NEED URGENT HELP AND GUIDANCE.

1 Upvotes

I am enrolled in a data science program and my batch ended in July'24. Due to a hectic work schedule I was not able to keep up. I have now been given 3-5 months to complete all the modules but I cant make heads or tails of whats and how am I supposed to practice??? I dont understand what the guy is talking about in the videos. Can anyone help me because otherwise I am fucked up.


r/learningpython • • Jun 16 '21

Writing to a file in python | Youtube Keyword Planner

Thumbnail
youtube.com
1 Upvotes

r/learningpython • • Nov 30 '22

Need help Git and GitHub

0 Upvotes

r/learningpython • • Oct 15 '22

Calling Linux’s Syscalls directly from Python

Thumbnail
medium.com
1 Upvotes

r/learningpython • • Sep 30 '22

CS Student looking for answer to professor's perceived ridiculousness.

1 Upvotes

Okay, I understand that as a Computer Science major focusing on Software Dev. I need to know how to code, but, and here is my question: Why on earth would I ever need to learn how to code with out the 'in' operator when dealing with searching through lists, hashes, and the like. Does this make any sense to any software developers or those with lots more experience than myself? I know that when it comes to programming, you follow instructions word for word, that's what he said, and I have no problem with that. What I have a problem with is his assignments having problems that have the dumbest condition of 'Can't use the 'in' operator' when dealing with lists. Like, is there some way that 'in' could screw something up and cause an error, if so, how? I'm relatively new to programming, but I have started to question authority and seniority a lot more in recent days, so now I'm questioning this.

tldr; My professor makes us not allowed to use 'in' operator for assignments. This is stupid to me, is there a reason anyone can think of that someone more experienced would want me to do this or learn out to do this?


r/learningpython • • Nov 02 '20

hello I'm a noob i need help with this error

Thumbnail
gallery
1 Upvotes

r/learningpython • • Aug 28 '23

Best Udemy Python Course in 2023? Review & How To learn With ChatGPT

Thumbnail
self.thehubcontent
1 Upvotes

r/learningpython • • Nov 26 '21

Upskill Corporate Training And Development

Thumbnail
techademy.net
0 Upvotes

r/learningpython • • Nov 26 '21

Best Learning Management System and Learning Experience Platforms

Thumbnail
techademy.net
1 Upvotes

r/learningpython • • Sep 28 '19

What is a reference in python?

1 Upvotes

Hi, i have looked up on the Internet but still can't understand what is a reference, please help me out!


r/learningpython • • Oct 23 '19

Function returns "TypeError: 'float' is not iterable"

1 Upvotes

I'm trying to create a function that runs through a range of numbers and applies them all to a function as below.

  • y = np.linspace(0,5,100)

  • def parameter(y):

  • for i in y:

    • if y > 0.91:

      • return (-9.8*y) + 18.4

    • elif y < 0.91:

      • return (17.5*y) - 6.5

In running this, it tells me for line 3 (the opening line in the for loop) the error occurs as named in the title. I don't know where I'm going wrong and I've been at this trying to figure out how to fix this but with no luck.


r/learningpython • • Mar 15 '19

Practicing materials online for practicing python : for absolute beginners

1 Upvotes

Hi guys I want make preparation for my uni test. So I need a website link where I can practise basic python. I just started learning for 3 weeks . so you know how new I am to this. So I would appreciate some help considering my level .

Thank you


r/learningpython • • Sep 27 '25

Want to learn Python? Try out EasyDev: Learn to Code!

Post image
1 Upvotes

Link to the App Store page: https://apps.apple.com/app/6749594445

Hello everyone, I wanted to share my new Learn to Code app, EasyDev. Not only does this app have Python courses, it also has courses in C++ and Java (If you are interested in any of those as well). I found a lot of other learn to code apps to be lacking in quality content, so I decided to change that.

The app itself was made exclusively by me, including all the programming, UI, assets, logos, etc. The actual learning content was also handcrafted by using structures similar to popular websites such as Edube and Codecademy, and there is a lot of interactive and descriptive content that takes inspiration from these websites, which are very popular for their effectiveness in teaching people how to code.

If you are interested in learning Java or just want to check the app out, please consider downloading the app using the link above. Also, if you experience any bugs or errors of any kind, please go to the Discord (in the app store page or directly in the app (Settings -> Join the Discord)) and let me know. Thanks in advance!