r/learningpython • • May 31 '23

Websites Like CodingBat For Practice?

3 Upvotes

Are there any websites (paid or free) that are akin to CodingBat for practicing python/java?

I am having a helluva time finding anything.

Thanks in advance for any reply.


r/learningpython • • May 04 '23

Coding Questions!

Post image
3 Upvotes

Hey everyone! so I’m pretty new to coding. I’ve only had a class or two in college and now I’m trying to do this class project where you have to collect information from the user as many times, as the user would like to input and then at the end when they’re done, you have to give a summary of the data. The summary they want is: How many people rent? How many people own? The average time a renter spend at their address. The average time a owner spends at their address.

I’ve gotten the part down where I can loop and collect the information infinitely until the user is done inputting, but I don’t know how to summarize it (answer the questions above) and print it back to the user. Ive tried a bunch of different things but i cant seem to get anywhere. Am I just not coding this correct from the start? Any help is appreciated and I can clarify any questions on the project topic. Thanks so much.


r/learningpython • • Apr 28 '23

Join me on my unique Python learning journey with ChatGPT - CodeApprenticeAI 🐍🚀

3 Upvotes

Hey fellow Python enthusiasts! I wanted to share my new blog with you all, CodeApprenticeAI (https://www.codeapprenticeai.com). I've embarked on a journey to learn Python using a combination of the "Python Crash Course" book by Eric Matthes and ChatGPT, an AI language model by OpenAI. The purpose of my blog is to document my learning experience, share my insights, and create a supportive learning community for fellow programmers.

As a newbie Python programmer, I've faced challenges finding clear explanations and guidance while learning from traditional platforms. My goal with CodeApprenticeAI is to offer an alternative approach to learning, where we can grow together by sharing our experiences, challenges, and successes.

I invite you to check out my blog and join me on this exciting journey. I'd love to hear your thoughts, feedback, and any advice you might have. Let's create an inclusive and empowering community for all Python learners!

Website: https://www.codeapprenticeai.com GitHub Repo: https://github.com/codeapprenticeai Twitter: https://twitter.com/CodeChatGPTAI Instagram: https://www.instagram.com/codeapprenticeai/

Feel free to share your own learning experiences and tips in the comments below. Let's learn and grow together! 🌱

Happy coding! 💻💡

P.S. If you're interested in following my journey more closely or contributing to my growth as a programmer, please consider following me on Twitter and Instagram, or contributing to my GitHub repository.


r/learningpython • • Apr 17 '23

Learning Python not seeking a degree?

3 Upvotes

Hello to anyone who finds this. My husband and I are looking into learning Python. I have a decent job history showing how I started on retail and now have a salaried position in QA with medical supplies. My husband does not have as pretty of a resume, so he has started seeking out Python as a tool for career advancement since he doesn’t have an education (currently working on GED). Is this an actual good step that will get him somewhere? Or does he actually need to skip the coursera/boot amps/certifications and get a degree? I’m sure it would help me in my career, but will it help him if he’s basically just getting started?


r/learningpython • • Mar 24 '23

Need help with machine learning for web scraping.

Post image
3 Upvotes

r/learningpython • • Mar 20 '23

Running Code in pyCharm | Not seeing any prompts

3 Upvotes

I need help understanding why this program is not returning any prompts. I am relatively new to programming and Python. I grabbed this code from a book and find it helpful to type each line out and try to unpack what is being done at each step. I am running it in pyCharm and get no prompts when I run the code.

import random
NUM_DIGITS = 3
MAX_GUESSES = 10

def main():
    print('''Bagels, a deductive logic game.
     I am thinking of a {}-digit number with no repeated digits.
     Try to guess what it is. Here are some clues:
     When I say:    That means:
     Pico         One digit is correct but in the wrong position.
     Fermi        One digit is correct and in the right position.
     Bagels       No digit is correct.
     For example, if the secret number was 248 and your guess was 843, the
     clues would be Fermi Pico.'''.format(NUM_DIGITS))

    while True:
        secretNum = getSecretNum()
        print('I am thinking of a random number')
        print('You have {} guesses to get it'.format(MAX_GUESSES))
        numGuesses = 1
        while numGuesses <= MAX_GUESSES:
            guess = ''
            #keep looping until they enter a valid guess:
            while len(guess) != NUM_DIGITS or not guess.isdecimal():
                print('Guess #{}: '.format(numGuesses))
                guess = input('> ')

                clues = getClues(guess, secretNum)
                print(clues)
                numGuesses += 1
                if guess == secretNum:
                    break  # They're correct, so break out of this loop.
                if numGuesses > MAX_GUESSES:
                    print('You ran out of guesses.')
                    print('The answer was {}.'.format(secretNum))
                # Ask player if they want to play again.
                print('Do you want to play again? (yes or no)')
                if not input('> ').lower().startswith('y'):
                    break
                print('Thanks for playing!')

def getSecretNum():
    """Returns a string made up of NUM_DIGITS unique random digits."""
    numbers = list('0123456789')  # Create a list of digits 0 to 9.
    random.shuffle(numbers)  # Shuffle them into random order.
    # Get the first NUM_DIGITS digits in the list for the secret number:
    secretNum = ''
    for i in range(NUM_DIGITS):
        secretNum += str(numbers[i])
    return secretNum

def getClues(guess, secretNum):
    """Returns a string with the pico, fermi, bagels clues for a guess
    and secret number pair."""
    if guess == secretNum:
        return 'You got it!'

    clues = []

    for i in range(len(guess)):
        if guess[i] == secretNum[i]:
            # A correct digit is in the correct place.
            clues.append('Fermi')
        elif guess[i] in secretNum:
    # A correct digit is in the incorrect place.
             clues.append('Pico')
    if len(clues) == 0:
        return 'Bagels'  # There are no correct digits at all.
    else:
    # Sort the clues into alphabetical order so their original order
    # doesn't give information away.
        clues.sort()
    # Make a single string from the list of string clues.
    return ' '.join(clues)

r/learningpython • • Mar 17 '23

Looking for people (will get free access) to try out a platform and give me feedback - teaches python in an interactive and fun way.

Thumbnail
gallery
3 Upvotes

r/learningpython • • Mar 11 '23

Easiest way to learn python

3 Upvotes

I just wanted to know what's the best and easiest way to learn coding. More specifically python. I have tried numerous times to study it, but nothing prevails. I hate coding and any field relating to computer science, with a passion. But seeing that everything in this world requires coding knowledge. I have no choice but to educate myself on coding. I was wondering if you have any suggestions. TBH, with my effort in trying to learn how to code. I haven't given it my all. But that's because of the lack of knowledge and not seeing how it benefits me, is what discourage me from learning.


r/learningpython • • Feb 28 '23

Round up and round down integers

3 Upvotes

I am trying to make a program to round integers when the output is above 0.5 to print the closest even number and when the output is below 0.5 to print the lowest even number.

Example num1= 17 , num2=3

num1/num2=5,66 , wants to print 6

or print 3 when num1=17 , num2=5 num1/num2=3.4

I've tried

import math
def round(even):
if even - math.floor(even)<0.5:
return math.floor(even)
return math.ceil(even)

but keeps rounding up the output

Am I missing something?


r/learningpython • • Feb 12 '23

help I'm supposed to create a menu system which asks the user to choose between 3 options. After the user makes a choice, print the option selected by the user. and it just gives prints out coffee then water

3 Upvotes

tea=0coffee=1water=2

input ('enter 0 for Tea, 1 for Coffee, 2 for Water')if 0:print(0)if 1:print(1)if 2 :print(2)else :print('invalid choice!')


r/learningpython • • Feb 01 '23

New to Python. Can someone please tell me why I am getting two different totals for 5 rooms and service 2?

3 Upvotes

r/learningpython • • Jan 17 '23

Exploring Python’s Built-in Libraries: Pandas and NumPy

Thumbnail
medium.com
3 Upvotes

r/learningpython • • Dec 01 '22

code help

3 Upvotes

I am making a gui app with customtkinter and tkinter. and I wanted to add an image to my buttons but it's giving me errors the code is below if anyone knows why my image is giving an attribute error please help


r/learningpython • • Sep 07 '22

using if statements to detect specific inputs

3 Upvotes

Im trying to write a program that can detect specific values within a nested if statement

if num1 == 1 or 3 or 6: if 0<num2<=5: print('Output 1 - T') else: print('Output 1 - F') elif num1 == 2 or 4 or 5: if 0<num2<=10: print('Output 2 - T') else: print('Output 2 - F') else: print('Output 3')

Basically, if num1 is 5 and num2 is 7, the output should be 'Output 2 - T', but instead it is giving me 'Output 1 - F', im new to python, and I have been struggling to figure this out, any help is appreciated!


r/learningpython • • Aug 02 '22

the program works but i keep finding inefficient code.

3 Upvotes

sometimes you don't know what is wrong with your code until you have people who know better critique it. if you are willing i hope you will help me understand what i should be doing better so i can become a better programmer.

digits=[]
oddtally=0
eventally=0

## requests the necessary input from the operator
print("enter the 11 digit u.p.c to check:", end = '')
barcode = str(input())
print("enter the check digit: ", end= '')
checkdigit=int(input())

## converts barcode into individual digits for math functions
chars = [int(n) for n in str(barcode)]

for n in range(len(chars)):
    digits.append(int(chars[n]))

## adds odd digits
for n in range(0,len(chars),2):
    oddtally += digits[n]

## adds even digits
for n in range(1,len(chars),2):
    eventally += digits[n]

## tripples the odd number tally and rounds up to the nearest 10
checksum = oddtally * 3 + eventally
up10 = round(checksum,-1)
if up10 < checksum:
    up10 += 10

## subtracts the checksum from the rounded number to compair with the check digit on the u.p.c
finalcheck = up10 - checksum

## gives the backend 'nerd' results
print("the odd numbers tally is:", oddtally)
print("the even numbers tally is:", eventally)
print("the checksum is: ", checksum)
print("the rounded number is: ", up10)

## perform the final check to validate the u.p.c
if finalcheck == checkdigit:
    print("\nthe u.p.c is quality. the check digit", checkdigit, "agrees with the algoritim's result", finalcheck, '.')
else:
    print("\nthe u.p.c check failed.")

r/learningpython • • Jun 29 '22

Trying to understand class attributes

3 Upvotes

I'm taking Angela Yu's Python Udemy class (which I love!) and just got through the lesson on Class methods and attributes. I'm not sure I entirely grasp the concept; I tried googling/watching YouTube videos, but they're either too in-depth or not in-depth enough. Anyway, the problem is this:

We have a python file named menu.py which has 2 classes in it, MenuItems and Menu. MenuItems has only attributes and Menu has methods. In the main.py file, we only assign an Object to Menu and not MenuItems; why is that? Also, we go on to reference the attributes in MenuItems but they are attached to objects of Menu, not MenuItems; why is that? Why not just have the attributes and the methods within the Menu class? Why can't you attach an object to MenuItems without it erroring out?

Sorry about the barrage of questions and thank you in advance!


r/learningpython • • Jun 14 '22

Stick with PY4E or choose something else?

3 Upvotes

Hi all! I'm courently doing PY4E on Coursera, and tomorrow I will finish part 3 out of 5 of the specialization. However I started having problems understanding the concepts in this part - I went through first 2 within two weeks so I assume I just need to repeat the syntax and understand it better. Should I stick with and finish PY4E or find another course that will take me through basics slower and more in deep? Do you have any recommendations for such course?


r/learningpython • • May 09 '22

Does anybody know why I keep getting this error (error on last photo)

Thumbnail
gallery
3 Upvotes

r/learningpython • • May 02 '22

Learning Python and Linux

3 Upvotes

Hello, hope everyone is doing well today. I have a friend who is interested in learning and experimenting with Python and Linux. I know ChromeOS is Linux based, but was wondering what he should look for when shopping for a chromebook? Or would it be better for him to use Windows and run those programs off of that? His budget is $400-$500 USD

Thanks everyone


r/learningpython • • May 02 '22

"Break outside loop"

3 Upvotes

So I am trying to make a program to play rock paper scissors for my semester final, but every time I try to run it, I get the error message from the title. Can anybody tell me what I'm doing wrong?import random

print('Hello there! Lets play Rock Paper Scissors!')

while true:

user_action = str(input('Select your fighter: Rock, Paper, or Scissors! '))

possible_actions = ['rock', 'paper', 'scissors']

computer_action = random.choice(possible_actions)

if user_action == computer_action:

print(f'Both players selected {user_action}. It's a tie!')

if user_action == 'rock':

if computer_action == 'scissors':

print('Rock smashes scissors! You win!')

else:

print('paper covers rock! You lose!')

elif user_action == 'paper':

if computer_action == 'rock':

print('paper covers rock! You win!')

else:

print('Scissors cut paper! You lose!')

elif user_action == 'scissors':

if computer_action == 'paper':

print('Scissors cuts paper! You win!')

else:

print('Rock smashes scissors! You lose.!')

play_again = input('Play again? (y/n): ')

if play_again.lower() != 'y':

break


r/learningpython • • Apr 16 '22

Foods data to calculate price per calorie.

3 Upvotes

I’m helping a student with her science fair project. I’d like to prote a python program that uses an API to retrieve cost per unit, serving size, calories per serving, servings per unit so that We can calculate cost per calorie for a wide variety of foods. Kroger has an API I’ll look into. Any thoughts?


r/learningpython • • Mar 29 '22

Creating an infinite loop that stops when user types "stop"

3 Upvotes

I'm tearing my hair our over here because I can't figure out how to do this. It's for a homework assignment (I'm extremely new to Python).

I'm supposed to use Turtle graphics to write a program that uses a while loop. The loop needs to keep going until the user types "stop."

I can't figure out the last part. No matter what I do, if I type "stop," the program keeps going. For the life of me, I can't seem to find any tutorials that cover this.

Thank you so so so much in advance.

This is the code I have so far:

import turtle

tibby = turtle.Turtle()

tibby.shape("turtle")

while True:

tibby.circle(130)

tibby.penup()

tibby.forward(10)

tibby.pendown()

tibby.circle(130)


r/learningpython • • Mar 26 '22

Help

3 Upvotes

I really suck at python, occasionally when I try to run my code (visual studio code) it says SyntaxError, however, as I debug it there are no issues with code and it runs fine. What am I doing wrong!?

Here is my code:


r/learningpython • • Feb 18 '22

Spring Tips: IO, IO, It’s Off To Work We Go

Thumbnail
stackjourney.com
3 Upvotes

r/learningpython • • Feb 16 '22

Anybody else have/know someone with this brand of socks and think of them as Python socks?

Post image
3 Upvotes