r/learnpython • • Apr 28 '21

Made my first piece of software, my employer has concerns

362 Upvotes

I do a job where I have to input a lot of data into excell, I made a QT (pyside) app which i can use to open the xlsx files and input the data without the whole excell UI.

the sys admin has some (Legitimate) concerns but I don't know how to answer them

from the email (I removed a few about networking / web because i know the answer to those) :

  • Can You categorically state that the software has no flaws or holes in it that hackers could exploit?

  • Can he justify the software is secure and cannot be manipulated/changed?

  • What security is built into the software?

(for reference) the sys admin is willing to look over the source code (which is open source)

can anyone point me towards somewhere I can learn how to answer these types of questions?

also if the data the application reads/writes isn't identifiable (no personal info) is this less/not concerning?


r/learnpython • • Mar 05 '21

Python input() function writes prompt to standard error instead of standard output

362 Upvotes

I'm using Python 3.9.2 on Arch Linux.

I'm trying to make an interactive shell program in Python. I ran into an issue where the shell prompt would sometimes come before the output of the previous command. Here's a small example program that demonstrates the issue:

while True:
    cmd=input('>>> ')
    print('This is the output')

Around 80% of the time, the program works as expected:

>>> hello
This is the output
>>> goodbye
This is the output
>>> test
This is the output

However, occasionally, this happens:

>>> hello
>>> This is the output

As you can see, on the second line, the >>> prompt is printed before This is the output is printed.

I tried to use strace to debug the program, and I found out that the input() function actually writes the prompt to standard error, not standard output (when the program is run interactively). Here are the relevant syscalls:

write(2, ">>> ", 4)                     = 4
read(0, "hello\n", 1024)                = 6
write(1, "This is the output\n", 19)    = 19
write(2, ">>> ", 4)                     = 4

You can see from the syscalls that the print() function writes to file descriptor 1 (standard output), but the input() function writes to file descriptor 2 (standard error).

This seems to contradict what the documentation says:

If the prompt argument is present, it is written to standard output without a trailing newline. The function then reads a line from input, converts it to a string (stripping a trailing newline), and returns that.

Is there a way to force input() to write the prompt to standard output instead of standard error?


r/learnpython • • Sep 07 '20

Excel šŸ“Š vs Python šŸ Should I choose Python over Excel ā€œto automate the boring stuffā€? Also what and how is VBA programming (Excel) different (in the automating department)? Help!

362 Upvotes

Hello, I recently bought two courses off Udemy both being complete crash courses on Excel and Python. I (only) know VBA programming in Excel can be used to automate stuff outside Excel like Microsoft Word and PowerPoint and so can Python. However, I’m at two minds over what to choose since both claim to do the same thing. Any sort of information would be appreciated! Thanks 😊


r/learnpython • • Nov 27 '19

Black Friday hack with python

362 Upvotes

So I just finished my python script to monitor the price of my target gadget this holiday. It’s going to be heavily discounted soon but it will go to the fastest finger.

I’ve written a python script with BeautifulSoup. I’ve also set email and SMS alerts in the script šŸ˜‚šŸ˜‚

Was just wondering if there’s any other person doing this for Black Friday and Fastest Finger deals.

Update: Long overdue but just thought I should add that I got the phone.


r/learnpython • • Feb 09 '21

Thank you for being a wonderful community

361 Upvotes

Hello, I have been beginning to explore python and this community has been so incredibly helpful and goes above and beyond. I am so used to being told to just google something, but as I am sure some of us know, sometimes the formatting just isn't quite right or applicable to our cases and you can't really troubleshoot with a website. Thank you! Your kindness and time spent to help others explore the CS world does not go unnoticed.


r/learnpython • • May 10 '20

Beginner Python data analysis project - critique greatly welcome!

361 Upvotes

Hi everyone,

I just finished my first Python data analysis project, and being a total beginner, I could really use some other perspectives as to the quality of my final product. I plan on building a portfolio of similar projects and using it for applying to social science research assistant jobs where some programming and analysis ability is highly preferred. Since I am entirely self-taught, I need some concrete examples of what I can do to share with potential employers.

With that said, while I'm sure there are areas that could be improved, would my project be worth sharing with some edits? Or is it actually just a total flaming trash heap that should be scrapped entirely? Positive critique and helpful suggestions appreciated!

Project

Edit: Wow, I did not expect to wake up to so many comments and upvotes! I really needed this boost, to be honest. I'm so grateful for everyone's kindness and suggestions, and I'm definitely going to go back and try and tweak some things! I hope I can pay it forward one day, but for now, to fellow noobs who are trying to set up their first project - just go do it! I basically just forced myself to create something after learning the basics, and it really helps the learning process to break things down and figure out how they work outside of a guided tutorial. Keep coding!

Edit 2: I've uploaded a new version of the project since this was posted, taking into account some of the suggestions everyone has made. It's still not perfect, but I think it's time to move onto learning with new projects.


r/learnpython • • Dec 20 '16

Python OOP Series

360 Upvotes

r/learnpython • • Feb 01 '23

Thank you guys.

359 Upvotes

Six months ago, I started a post here asking why I didn't seem to understand Python.

At that point, I had "known" Python for three to four years and yet didn't understand any of it. I could scrape passes, but that's about it.

I didn't understand any workflow, I barely knew how to start Jupyter properly.

I didn't understand it, I didn't enjoy it, and I found it hard to understand why so many other people were succeeding at it while I was failing spectacularly.

After explaining the problem, which was that I couldn't "see" the results of individual steps, many of you suggested notebooks and the like.

I eventually settled on Visual Studio Code.

After a few weeks on W3schools exercises to relearn the basics, I dived into writing my own code.

With the aids of VS Code, whether it be the autocorrect, the colour coding of existing variables, or the helpful "did you mean X?" when I made small mistakes like typing x instead, mistakes that would usually take me fifteen minutes and endless frustration to find, I began being able to focus on the bigger issues.

I began understanding the issues and slowly analysing them, and finally was able to troubleshoot my own code. I was beginning to gain interest.

This week at work, I managed to troubleshoot someone else's Python code not just on one PC, but on two.

I kept going when even the person who wrote the code had given up.

Then I fixed the second issue that popped up on both.

After that, the code ran perfectly. My colleagues were incredibly grateful because it meant that they could spend less time manually comparing thousands of entries against one another.

I felt like it had gone full circle. From being that person who was struggling with cryptic error codes to now becoming that person who could fix it.

I still have a long way to go, but I've made way more progress in a few months than I thought I ever would.

So thank you, for showing me that coding is truly enjoyable.


r/learnpython • • Nov 01 '21

Who here is working through Angela Yu’s 100 days of code?

358 Upvotes

I don’t know if there is an active community of current students to compare notes somewhere. Currently I’m on Day 38.


r/learnpython • • Sep 06 '20

Am I stupid for not knowing how to do Complete Python Bootcamp: Go from zero to hero in Python first milestone project???

358 Upvotes

man......

I paid attention, I was positive. I did everything I could

I have a bachelors degree in STEM, I'm an educated individual.

but I have never felt this lost

I got to the first milestone project where I had to create a tic tac to game and I literally had no idea how to do any of the steps.

please tell me someone else out there has shared my experience

I'm on here looking to put the shattered pieces of my dignity and self worth back together LOL!

i cannot believe how hard that was


r/learnpython • • Feb 18 '23

I've created a Senior Python Developer roadmap

357 Upvotes

I am a Senior Python Developer and it's always been a pain to find a resourse that will let me upgrade from mid level to senior, so I decided to create one where I focused on topic that will let Junior developers upgrade their knowledge to the Senior level.

I would appreciate any feedback you can provide me with, in case if you can advice which topics might be included, please let me know or open a PR🄺

https://github.com/pro1code1hack/Senior-Dev-Roadmap


r/learnpython • • Nov 12 '22

Help with Python automation at work to free up time as single Dad.

357 Upvotes

Hi all,

Quite embarrassed about this and unclear how best to word it - I’m just going to be authentic and honest and see where it gets me—

The ask is about python and help in work task automation.

Here goes… Discovered Wife has been hiding serioud drug addiction problem. We have 3 kids. She became violent and eratic. She’s got to get better and is going to an inpatient treatment ctr. I will be Dad and Mom for forseeable future.

— I need guidance on how I can automate tasks at work (python), allowing me to complete those tasks more quickly. Trying to get my work done more quickly so I can be home and present as Dad to my kids. —

Details: I am a PM in an org that uses Excel for planning, roadmaps, risk/issue tracking, etc (I don’t know why). Its copy rows from one sheet, move to another sheet or report, change formats to match whatever new sheet format is. Creating ppt slides with inputs from excel sheets, modify to whatever ppt layout is used. Send status updates in email/slack, reports, etc. Hours of time counting / shading in cells based on lead time and take type. This is done for ~300 rows and the lead times are different depending on the item. I feel like these could all be automated or at least much of the manual input reduced.

(I can’t change what tools we use or how we use them. I’ve tried.)

Despite the tedious stuff it is truly a good job that I must at least try to maintain performance even with the current situation It is what supports us and what has helped put away enough money to cover all 3 kids’ college tuition, if they choose to go to go someday.

I do have some help from my Mom and Dad. I’m looking into daycare, etc.

Hoping this type of post is okay. If necessary, I am happy to direct message the mods and prove that my situation is real. I’ll also answer any questions asked in this thread aside from personal info.

Again, I appreciate this community and any help would be fantastic.


r/learnpython • • Dec 08 '21

Simple tip from a long time C/UNIX programmer now learning Python.

357 Upvotes

When you are first starting out to learn a language like Python, type every line of code yourself, rather than just cutting and pasting google results. Even if you type an exact copy, the simple act of typing will help you quickly memorize the basic structures of the language.


r/learnpython • • Sep 27 '19

If someone told you they know Python, what would you expect them to know?

356 Upvotes

Or for example, if someone put Python on their resume. What sort of things would you ask to determine what they actually know, or at least instill some confidence in you.

Edit: Well then, looks like I have some responses to go through! And lots to learn! lmao


r/learnpython • • Nov 07 '20

Ive finally written my first script for work! But there is a problem...

355 Upvotes

I started learning python not long ago and Just a few days ago I finished my first script that has some helpful application at work. It’s a super simple script that reformats a CSV file from a vendor, but It saves a lot of time and headaches.

Here’s the problem, how do I share this script with my non-tech savy coworkers while we’re all working from home? I realize I can just send them the .py file but they’ve never run python in their life. Am I really supposed to just send them this and say ā€œinstall python and then also pip install pandasā€?

I know some coding but I don’t have an in-depth understanding of technology so if there is an obvious answer to this problem, sorry. But any help would be appreciated.

Edit: Cant emphasize how much I love this community. Really appreciate all the help.


r/learnpython • • Nov 03 '25

Junior Python Dev here. Just landed my first job! Some thoughts and tips for other beginners.

354 Upvotes

Hey everyone,

I wanted to share a small victory that I'm super excited about. After months of studying, building projects, and sending out applications, I've finally accepted my first offer as a Junior Python Developer!

I know this sub is full of people on the same journey, so I thought I'd share a few things that I believe really helped me, in the hopes that it might help someone else.

My Background:

Ā· No CS degree (I come from a non-tech field). Ā· About 9 months of serious, focused learning. Ā· I knew the Python basics inside out: data structures, OOP, list comprehensions, etc.

What I think made the difference:

  1. Build Stuff, Not Just Tutorials: This is the most common advice for a reason. I stopped the "tutorial loop" and built: Ā· A CLI tool to automate a boring task at my old job. Ā· A simple web app using Flask to manage a collection of books. Ā· A script that used a public API to fetch data and generate a daily report. Ā· Having these on my GitHub gave me concrete things to talk about.

  2. Learn the "Ecosystem": Knowing Python is one thing. Knowing how to use it in a real-world context is another. For my job search, getting familiar with these was a massive boost: Ā· Git & GitHub: Absolutely non-negotiable. Be comfortable with basic commands (clone, add, commit, push, pull, handling merge conflicts). Ā· Basic SQL: Every company I talked to used a database. Knowing how to write a SELECT with a JOIN and a WHERE clause is a fundamental skill. Ā· One Web Framework: I chose Flask because it's lightweight and great for learning. Django is also a fantastic choice and is in high demand. Just pick one and build something with it. Ā· Virtual Environments (venv): Knowing how to manage dependencies is crucial.

  3. The Interview Process: For a junior role, they aren't expecting you to know everything. They are looking for: Ā· Problem-Solving Process: When given a coding challenge, talk through your thinking. "First, I would break this problem down into... I'll need a loop here to iterate over... I'm considering using a dictionary for fast lookups..." This is often more important than a perfectly optimal solution on the first try. Ā· A Willingness to Learn: I was honest about what I didn't know. My line was usually: "I haven't had direct experience with [Technology X], but I understand it's used for [its purpose], and I'm very confident in my ability to learn it quickly based on my experience picking up Flask/SQL/etc." Ā· Culture Fit: Be a person they'd want to work with. Be curious, ask questions about the team, and show enthusiasm.

My Tech Stack for the Job Search:

Ā· Python, Flask, SQL (SQLite/PostgreSQL), Git, HTML/CSS (basics), Linux command line.

It's a clichƩ, but the journey is a marathon, not a sprint. There were rejections and moments of doubt, but sticking with it pays off.

For all the other beginners out there grinding away—you can do this! Feel free to AMA about my projects or the learning path I took.

Good luck!


r/learnpython • • Sep 30 '22

My 1 year journey from complete Noob to Data Analyst in big corp(can help you as a roadmap)

354 Upvotes

Hello,

id like this to be a kind of a roadmap for anyone on learning journey. Ill try to go thoroughly through this, but short. Ill also bold up important info if you want to skim through text.

Background:

31 year old. Finished economy(Finance Major) and worked on a non fullfiling job that i hated. Wanted a change, had a lot of spare time on work which i fully used into studying. Living in country with bad economy. My pc knowledge came from...well...what you get to know from gaming. I also always knew very well hardware, building PCs, all the little caveats about it etc. But I never even touched any kind of coding, or even learned about it.

Ive studied 8-16hours a day. About 5 hours of study on job and, depending on obligations / weekend/wifes workshifts and taking care of our small baby back then, id study 4 - 8 more hours afterwork, while doing 16hrs a day on weekends. (mad respect to wife for giving me all the time)

First days i researched what i want to learn. First though was SQL but i quickly found out i need something bigger. I basically didnt know anything at all about languages and programming, not even what a front end and back end is. So after research i decided its going to be Python. I installed it, installed pycharm, turned on a 6h youtube video from Mosh and started learning. I fell in love and the interest in me grew to a maximum level. Finished that video in 2 days(not whole because later he goes into machine learning,which isnt really beginner lvl).

Ive learned basic stuff, basic synstax, data types and methods to use with them. math operations and comparisons, if statements, loops. I very well immediatelly understood everything i went through.

3rd day i made a stickman game and studied a bit more

4th day i made a labirinth game. A basic printed out in terminal and you input commands where to go(an IT colleague gave me the idea when he said it was as far as he went in programming). It was working without bugs and errors, nicely coded with lists of lists.

These two little projects taught me soo much. Ive learned more than from any source i couldve taken to study. I quickly learned doing projects and biting onto way harder things than i though i would even know anytime soon would be the best way to study for myself. It included looots of googling, stack overflow and youtube, rather than following simple things on youtube tutorials.

Ive then read a 200 page python beginner script my cousing gave me from his Uni, it took me 3 days to follow it with code.

Ive learned the basic stuff in more detail, including functions, and ive read about classes but i just didnt understand them....and i actually didnt understand classes fully for a very long time.

Then on day 7 i started working on a text based rpg , but without class knowledge i didnt advance too far, maybe after a week i ditched it. I did learn alot about dictionaryes, json files, storing data, using multiple files for projects etc. In meantime i also learned alot about virtual environments and how to use them.

Then i read automate the boring stuff, and watched the video on it, which took me a couple of days, then i read about 300 pages of Learning python, just the parts that explain what happens in background of python and how it interacts with hardware, how it runs on C, why its slow, what makes it a dynamically typed language etc. Didnt do any coding, just read those days. Ive also watched some youtube videos in that time, trying to get an idea what to work on, something large and complicated, not just a small coding challenge.

On day 30 i got an idea and started working on scraper for all the airsoft sites and idea was to make a web page with price comparisons. Ive done this for more than 30 days, then realizing there was a page that was just recently created doing the same thing. During this time i also went through Udemy course on html/css and stopped when i went through JS basics. All of this together improved my scraping(requests, bs4 and selenium) skills drastically, basically becoming really great in that field. Ive also done alot of pandas, learned from youtube videos, and regex, learning alot about data bases and data manipulation, but pandas didnt really sit there that well yet.

After that i went into creating a software that connects to Dota api(game state integrator). Its basically an api that lets you read real time dota info from matches, like score, player stats, player positions etc. Ive tried making a software that reads player positions and creates heatmaps of where the kills and ward drops happen. Learned alot about sockets, numpy and matplotlib. I remmember trying to first write down an matrix of 16000x16000(size of dota2 grid) and increment values for the position where kills and wards happen quickly learning thats way too much memory. Then i learned about numpy arrays. I also included UI for this software, so i learned alot about tkinter and threading. This was also first time i understood classes, but was not yet 100% on them.

Afterwards i went onto biggest project for me, which was also connected to dota. I could write about it for couple of pages, so ill try to keep it as short as possible. It included lots of multiprocessing, piping data, lock keys, open CV and pretty neat algorithms. It detected in parallel video and static picture ads on multiple streams across the monitor, which were automatically opened and rearranged on screen, from multiple stream providers, all packed with a simple UI in tkinter. Ive never finished it, but i did 90% of the project. I only had to do data processing and all the automatic statistics calculations on the data it collects, but after 2 and a half months of whole days work, i burned out completely. I wrote over 8000 lines of code , multiple files, lots of googling and learned SO MUCH. Then a new game came out which i wanted to play for a long time and decides to take a break for like 3 months.

I slowly built up will power to continue studying by the end of the year(around 6-7 months since beginning). I feared i wont be able to continue, that im completely burned out. but i started researching machine learning a bit more, watching youtube videos etc. I havent touched any code , anything at all for 3 months total at that time. I decided id start from january 1. again for real, and i actually did.

Started off with a fat math book. Linear algebra, calculus, markov chains, all the stuff needed for machine learning. I did study most of this through Uni, but i completely forgot it, since i havent touched math for more than 6 years. After exactly 30 days of studying that book for 8 hours a day, i was done and went with a book on machine learning by Sendtex. It was marvelous and taught me alot. Thats first time after 4 months i coded. After 2 weeks on that book, i went with multiple youtube videos from Dr. Phil on youtube, sendtex, deeplizard etc. Then i fell in love with auto pilot cars and started watching some courses about self driving cars from Tubing university.

Then i decided i want to make a self driving car in Carla simulator.

I had multiple attempts at creating an deep determenistic policy gradient AI for a car driving on a 80x80 pixel camera and having a lidar, that had values also shown on camera through focal lens equations but it never learned anything. Then i created another environment with a car that has Lidar and Semantic camera, and all the data from semantic camera and lidar was shown in birdseye view. The AI also didnt learn anything in that environment, but the code that went into creating it was very heavy on numpy and math, and its the code im proudest of. This is first time i learned more advanced class stuff aswell.

In the end i created a simple parking bot, with 8 distance sensors and it actually worked. Thats first time i actually understood some more important principles about the neural networks i was working on. This whole project was also big on object oriented programming and i kinda "cemented" my knowledge on it by now.

in meantime i made a smaller CSGO GSI program(basically same thing as for dota), but this one gathered all the data about the games and organized it in pandas, didnt finish visualization with matplotlib. I did this project just to thoroughly learn pandas(i did use it alot before but never knew it without too much googling), after thoroughly learning numpy through carla simulator. I cant say im that good with matplot. I also dont remmember when i learned basics of SQL, but i kinda went through that in 2 days and found it simple. Never went into advanced stuff. I also dont remmember when i learned basics of linux and used it a bit. Before i landed job, i installed conda and learned how to use it instead of pip and default venvs. I also read a book on scraping, python data science handbook and some other books i cant remmember now.

There were also nuuumerous other things i cant remmember, that i watched on youtube, read on reddit, done codes on codewars etc. If i didnt work on a project, i was reading something or watching something about python.

At about that time i landed a job as a data analyst. I will continue my study, especially on machine learning and AI field. In the end i want to be a data scientist. Currently im having a break from that and decided to build a bit more advanced discord bot, because i wanted a project with Async. Its in the work for like 10 days now and will take probably much more time. After that plan is to return to the beginnings of machine learning and statistics , and relearn it all from scratch, now when i understand it all much better.

I guess the end :).

If youve read this far, thank you. I hope it will help someone or maybe motivate you. After years of semi depression because of unfullfilling jobs, im finally happy with what im working. Initially i never though it would take me just a year to turn over my life, but it comes fast. So even if you think it will take you longer, just keep studying. Doing nothing certainly wont do any change. The one thought that always kept me motivated : An hour of study is an hour closer to my goal. I kind of never looked too far, just an hour by hour. Each hour of work means i stacked more knowledge in my head. Each solved error and bug means i made major step towards my goal.

Good luck in your study!

Edit:also forgot an important thing. When you get some good knowledge, read a book on data types. I suggest for begginer level a simple book with awesome handmade drawings made by grokking. Then i just skimmed through some more detailed book(i dont know name)


r/learnpython • • Jan 05 '21

Interview question I failed answering

354 Upvotes

Hey all,

I just had an interview and the interviewer gave me a question I could not answer.

He asked me to write a function that accepts a number, the number must be either 7 or 4.If the number is 4, the function should return 7, if the number is 7, the functions should return 4.

The tricky part: you cannot use an 'if' statement in the function.


r/learnpython • • Oct 03 '19

i decided to start learning python and i've been watching the same 5 videos over and over again to try and remember the lessons, am i mentally challenged or is that how most people start.

354 Upvotes

help

edit: thanks to every one who made a helpful response, it may not seem like it but i read every commeny and i greatly appreciate it.


r/learnpython • • Jun 01 '20

Built PONG! I am soo happy!

353 Upvotes

I was doing the course "An Introduction to Interactive Programming in Python (Part 1)" by Rice Uni in coursera and there was a assignment were we had to build the pong game. This is actually something I am really proud of! Took me around 7 hours and lots of messy code!

Would love any code feedback!

PONG GAME

ps: click the run button in the editor


r/learnpython • • Sep 22 '16

How to start learning Python ? The Complete guide.

352 Upvotes

I recently started learning Python Programming. But after few days only, I got super-confused. So I am not able to decide about the approach I should follow to learn Python Programming.

  • Should I just read books (cover by cover).

  • Should I make notes and learn the syntax.

  • Should I watch Online tutorials and lectures and do coding.

  • Should I use sites like https://www.codecademy.com/ , which teach coding online.

  • Should I dive straight into projects.

I not only want to learn the syntax but also learn about the mechanism behind it. I do have a little programming experience. There was an intro course in C programming in first semester in my university. But there was not much I learnt in it. As I had no programming experience before it, and the course mainly focused on learning and understanding syntax of C.

I guess there might could be few other students/ learners/ programming-enthusiasts, who are just starting programming or had rough past experience with programming and wish to learn Python and not just mug-up the syntax but also understand the underlying mechanism. Also I am really interested in topics like machine-learning , data mining and web-development. So I would love to work on relevant projects after learning Python programming.

So, I request all the Python gods, self-learners and programmers to help me and other beginners. Please share your path, how you learnt.

Discovered Resources:

Books:

Video Tutorial:

Online Practice:

Discussion:

Guide:

Reading:

Github:

Competitive Programming:

I guess at some point we all have to start the learning process. But at times due to lack of proper knowledge and resources, few of us end up giving-up or learning bad habits along the way. But with help of community, we all can learn something from each other. So please help any how you can.


r/learnpython • • Dec 09 '22

I finally got over "the hump"

351 Upvotes

I hate to admit it, but after literally years of reading books and practicing, it finally hit me. I finally got that light bulb as I was coding.

how?

github co-pilot and chatGPT.

yes I know these are robots but its just so easy to understand now. I was struggling through a script like I always do, and finally decided to use co-pilot. it would literally tell me the code I need. and if I had a question...."this isnt printing all I need" or "print this full list but break it up into parts", just pop it into chatgpt and boom, its all there.

given my years of trying to learn, the answers came naturally after it was perfectly explained and shown.

this robot stuff is going to really change things.


r/learnpython • • Jun 26 '20

So, uh, I'm TRYING to code a simple dnd battle simulator, and classes are a nightmare

351 Upvotes

Hey there, I'm a self-taught noob that likes to embark on projects way ahead of my limited understanding, generally cos I feel they'll make my life easier.

So, I'm a DnD Dungeon Master, and I'm trash atbuilding balanced combat encounters. So I thought, hey, why not code a "simple" command line program that calculates the odds of victory or defeat for my players, roughly.

Because, you know, apparently they don't enjoy dying. Weirdos.

Thing is, after writing half of the program entirely out of independent functions, I realised classes *exist*, so I attempted to start a rewrite.

Now, uh...I tried to automate it, and browsing stackoverflow has only confused me, so, beware my code and weep:

class Character:

def __init__(self, name,isplayer,weapons_min,weapons_max,health,armor,spell_min,spell_max,speed):

self.name = name

self.isplayer = isplayer

self.weapons_min=weapons_min

self.weapons_max=weapons_max

self.health=health

self.armor=armor

self.spell_min=spell_min

self.spell_max=spell_max

self.speed=speed

total_combatants=input(">>>>>Please enter the total number of combatants on this battle")

print("You will now be asked to enter all the details for each character")

print("These will include the name, player status, minimum and maximum damage values, health, armor, and speed")

print("Please have these at the ready")

for i in range(total_combatants):

print("Now serving Character Number:")

print("#############"+i+"#############")

new_name=str(input("Enter the name of the Character"))

new_isplayer=bool(input("Enter the player status of the Character, True for PC, False for NPC"))

new_weapons_min=int(input("Enter the minimum weapon damage on a hit of the Character"))

new_weapons_max=int(input("Enter the maximum weapon damage on a hit of the Character"))

new_health=int(input("Enter the health of the Character"))

new_armor=int(input("Enter the AC value of the Character"))

new_spell_min=int(input("Enter the minimum spell damage of the Character"))

new_spell_max=int(input("Enter the maximum spell damage of the Character"))

new_speed=int(input("Enter the speed of the Character"))

As you can see, I have literally no idea how to end the for loop so that it actually does what I want it to, could you lend a hand, please?

Thanks for reading, if you did, even if you can't help :)

EDIT: Hadn’t explained myself clearly, sorry. Though my basic knowledge is...shaky, the idea was to store the name of each character and map it to each of their other attributes , so that I could later easily call on them for number-crunching. I don’t think pickle is a solution here, but it’s the only one i have had some experience with.

EDIT 2: Thanks y’all! You’ve given me quite a lot of things to try out, I’ll be having a lot of fun with your suggestions! I hope I can help in turn soon .^


r/learnpython • • Apr 09 '19

How did you manage your time to teach yourself python while working a full-time job?

350 Upvotes

I am determined to learn python. I want to turn my career and life around. I do not want to be in my dead-end job anymore. But I can't do it alone, so please help me out.

For those who eventually did a career change into programming learning python while working a full-time job, how did you manage your time? What sources did you use?

At the moment, I chose "Python Crash Course" and I intend to read "Automate the Boring Stuff" next.

Also, I don't know exactly in which department I would like to work for, but probably data analytics. But artificial intelligence, machine learning, and robotics do interest me as well.

Anyway, I would appreciate any tips for this new noob into python world. Thank you in advance!

***EDIT***

I'm so thankful for everyone who commented and gave me some tips! I did not expect to get all these answers. So, what I'm going to do is actually enroll in "Learn Python Programming Masterclass" on Udemy which was suggested by u/BigTheory88 and side by side going over what I've been reading already, "Python Crash Course." I've also downloaded "Solo Learn" app, so I can keep studying during my breaks. I'm going to set aside at least an hour during the weekdays to study. And I'll invest more hours to study during the weekends. I'll make short-term goals per day by trying to complete a chapter or concept. I am determined because I want to change my life. I cannot continue to live with my current low-paying dead-end job. I understand and recognize the fact that I need to learn a new skill to get out of my current job and start my new journey into programming. I have a 1 year goal to be hired into a programming job for now. And I am looking forward to the future and myself posting my progress and result, no matter what the outcome. I am optimistic and motivated (for once) to meet my goal. Thank you once again to everyone! I hope to post my failures and successes by April 2020!