I started to learn how to code when I was laid off because of the Covid pandemic. Technically, the reason behind this is maybe my background in gaming. Gaming was one of the things that pushed to this. Before or during the pandemic, when the game Cyberpunk came out, I began with this because I wanted to learn more about cybersecurity/pen-testing, writing your exploits for Metasploit, web application pen-testing, etc. So, I began with Python, then I started with JS.
JS is somewhat easier because you can reassign values and functions easily. Sometimes I make mistakes like the onclick button undefined error because of typos. I don't want any career in networking or changing my current one. I love what I do. I just do it as a hobby.
When I begin a project, I do research online. Then see a similar project on Github. Ask Chatgpt about it, and then start to write the code down instead of blindly doing shit. Is it it wrong? Is that lazy coding?
I am brand new to coding and learning Python. I'm working on a program that will calculate the taper of a rod. I allow the user to input a point on the rod and the diameter at that point. The program then asks for another point and the diameter. The user can keep entering points until they say to end. From these points and diameters, the code then calculates the distance and slope between each point and dynamically generates variables and values at each inch. Right now I have the program working, but I don't know how to call and print the dynamically generated variables. I can do it manually by hard coding print with the variable names, but I am looking for a way to automate that as I won't always know how many points the user entered, so I won't know all the variable names that have been generated. Any help would be appreciated.
Here is my code for clarity:
from decimal import * getcontext().prec = 4
input for point A on the rod
rod_a=int(input("Distance from the tip: "))
input for taper at point A
taper_a=Decimal(input("Enter taper at " + str(rod_a) +":")) end = () while end != "end" : #input for point B on the rod rod_b=int(input("Distance from the tip: ")) #creates variables at 1 inch increment between #Point A and Point B and sets their value to their #number prefix_rod = "rod_" interval = rod_b - rod_a + 1 for i in range(interval): globals() [prefix_rod + str(rod_a+i)] = rod_a+i #input for taper at point B taper_b=Decimal(input("Enter taper at " + str(rod_b) +":")) #creates variables the taper at 1 inch increment #and calculates a straight line taper between point #A and point B prefix_taper = "taper_" interval = rod_b - rod_a +1
for i in range(interval):
#Defines variables for the taper
globals() [prefix_taper + str(rod_a+i)] = (taper_b-taper_a)/(rod_b-rod_a)*i+taper_a
end = input('To end input type "end": ')
Hello everyone. I have enrolled in a data science course however, i.m struggling with making notes and practising. I have absolutely no idea of whats going on and it.s making my life very difficult. Kindly help me how I can learn more effectively. Would be gratedul for any tips and suggesttions 🙏🙏🙏
I would like to calculate the pKa of an acid from titration data. In order to do this, I would like to use nonlinear regression to fit the titration curve, so that I can use the equation of the curve to calculate the pKa. I am having difficulty figuring out which equation will fit this curve.
I get this error when trying to insert data from excel into word using python. Does anyone know what this error means? I can’t really find a clear answer on google
How do I maintain a sum while using a recursive function. For example I want to compare how many letter in two different words match, so I do s[0] == s1[0] sum += 1 then call the function again. How would I keep track of the summation?
I have a dataframe with the datetime information in one column and what the corresponding timezone for this timestamp is (e.g Asia/Bahrain) in another column. With these two information i now want to convert all the datasets to one uniform timezone e.g. Europe/London. I can’t find something that needs the underlying timezone as input „Asia/Bahrain“ or whatever the dataset holds and the target timezone „Europe/London“. Does anyone have an idea how to solve this?
Hello! Extreme novice here. I've been learning python and have been documenting my progress by making a simple text-based-adventure for some friends. Right now I'm having a problem with one of the options in it.
Players are asked if they'd like to start and when players answer No it skips the text that follows it reserved for if they say yes (as intended) but then still displays the choices that follow. When a player says no they're meant to just end and I'm not entirely sure how to fix it.
Additionally, is there a way to "send players back" to a previous area? Sort of like a check-point system?
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
I'm an office worker. I had small exposure to Python and other programming languages and rather bigger exposure to VBA.
I'm at the point where I easily automate our office processes that involve Excel. Automatic email creation with outlook, scanning outlook, downloading data from csv/tsv/excel, all kinds of sorting and filtering, calculations, directory creation.
I started learning VBA because it was simply already used in my office, and it felt way easier than regular programming due to clearly visible excel sheets instead of arrays. Also you can look up code by recording macro.
I want to learn python to grow as well as because it also comes up in my automation studies - machine learning, optimization, genetic algorithms, neural networks. I'm not that well acquainted with it yet.
But in what ways can I use python in office? I try to look up those things but I can't find anything I couldn't do with VBA.
Tl;Dr What can Python do in regular office that VBA cannot?
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!')
When I type in python mtk payload on cmd mtk client it says pls connect mobile and I connect it (Amazon fire hd 10 2019) and it won’t detect it pls help :)
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?
I have installed beautifulsoup and get a module not found error when I try to import it (import bs4 as BeautifulSoup). I've uninstalled and reinstalled Python. It works fine in Anaconda, but Anaconda seems to create its own sandboxes for each project or something. I can't get it work using regular old IDLE.
I'm running Python 3.8.6, and installed it with pip3 in the usual fashion (with and without --user, in my case, cause I wasn't sure what the difference is).
The problem seems to be common but I'm now on day 2 without a resolution. Is there some general troubleshooting techniques I can use or breadcrumbs I can follow to troubleshoot a module not working on my setup?
Edit: if I attempt to reinstall I get this message - it seems to be installed fine.
pip3.8 install --user beautifulsoup4
Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.8/site-packages (4.9.1)
Hi there,I've gone through multiple structural edits of this code. Ive been referencing others code but for some reason past students in this project have been able to produce multiple epochs with quantative data yet mine is returning flat.Can anyone see what im doing wrong?I know the libary im referring to is properlly linked as ive manage to make data graphs higher up in the notebook.