r/pythonhelp • • Jan 02 '23

Just installed python 3.11 where do I go from here?

3 Upvotes

I just installed python 3.11 on my windows pc, what is my next step to start programming. How do I start making programming projects?


r/pythonhelp • • Dec 27 '22

New to python from Matlab. Seem to be getting a strange response

3 Upvotes

I am used to defining a function in the following method, but unfortunately, it does not seem to be working. Could someone help me out?

x = np.linspace(0, 50, 2001)
for i in range(len(x)):
Vk[i] = 0.5*k*(x[i])^2 -(1/3)*a*(x[i])^3
plt.plot(x, Vk)


r/pythonhelp • • Dec 23 '22

Calculating weight on planets

3 Upvotes

Hello,

I am trying to learn python on my own and i am having a difficult time with this exercise where I have to calculate the weight of a person in a x planet, can you give some guidance pls?

Thank you all in advance.

The exercise goes like this:

"Due to the difference in gravity on each celestial body, your weight is nowhere the same as on Earth. on

on some celestial bodies the gravity is greater and you therefore weigh more, on others the gravity is less

and you weigh less.

Which celestial body is best for you to move to to achieve your ideal weight? Enter your weight, choose one

celestial body and perform your mass on the chosen celestial body.

 your mass on the moon = weight x 0.166

 your mass on Jupiter = weight x 2.36

 your mass on Mars = weight x 0.37

 your mass on Venus = weight x 0.9

 your mass on Neptune = weight x 1.12

parameters

The weight is a decimal number.

The celestial body is entered correctly: moon with a small letter, Jupiter, Mars, Venus and Neptune with

one upper case letter.

For any other celestial object or incorrect spelling, you display an error message."

I can get any further than this:

weight = float(input("Give your weight in(kg): "))
planet = input("In which planet are you? ")
#moon * 0.166
#Jupiter * 2.36
#Mart * 0.37
#Venus * 0.9
#Neptune * 1.12
if planet == moon:
  weight = weight * 0.166

print("At " + str(planet) + " your weight is " + str(weight) + " kg")

I know is not far completed but wanted to test if it calculated correctly en it doesn't.

Result is:

Give your weight in(kg): 90

In which planet are you? moon

At moon your weight is 90.0 kg


r/pythonhelp • • Dec 13 '22

Can't get the xformers library installed into stable diffusion

3 Upvotes

I've tried a lot of different things from github and from other places on reddit but I can't seem to figure this out so I figured it was probably time to actually investigate the issue.

So when I add --xformers to the commandline_args string in launch.py (which is supposedly the way install this) it just crashes with this output.

wh33t@wh33tbox:~/stable-diffusion-webui$ source venv/bin/activate
(venv) wh33t@wh33tbox:~/stable-diffusion-webui$ python launch.py 
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
Commit hash: 685f9631b56ff8bd43bce24ff5ce0f9a0e9af490
Installing xformers
Traceback (most recent call last):
  File "/home/wh33t/stable-diffusion-webui/launch.py", line 294, in <module>
    prepare_environment()
  File "/home/wh33t/stable-diffusion-webui/launch.py", line 230, in prepare_environment
    run_pip("install xformers", "xformers")
  File "/home/wh33t/stable-diffusion-webui/launch.py", line 78, in run_pip
    return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")
  File "/home/wh33t/stable-diffusion-webui/launch.py", line 49, in run
    raise RuntimeError(message)
RuntimeError: Couldn't install xformers.
Command: "/home/wh33t/stable-diffusion-webui/venv/bin/python" -m pip install xformers --prefer-binary
Error code: 1
stdout: Collecting xformers
  Using cached xformers-0.0.13.tar.gz (292 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'

stderr:   error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-p_qus4ba/xformers_c337561fd2d6424ab02d68796aaf774b/setup.py", line 239, in <module>
          ext_modules=get_extensions(),
        File "/tmp/pip-install-p_qus4ba/xformers_c337561fd2d6424ab02d68796aaf774b/setup.py", line 157, in get_extensions
          raise RuntimeError(
      RuntimeError: CUTLASS submodule not found. Did you forget to run `git submodule update --init --recursive` ?
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.


(venv) wh33t@wh33tbox:~/stable-diffusion-webui$

Can someone explain to me what those error messages mean? Is it because I'm using the wrong Python version or something? I don't get how this can work for so many people but not for me.


r/pythonhelp • • Dec 11 '22

Transforming a .py file to a .exe and then sending to friends

3 Upvotes

Hi everyone! First I don’t know if this belongs in this sub because it’s not directly related to my code but more about python and how to turn it into an exe the proper way and possibly send it to someone? So if this isn’t allowed I’m sorry. I’m a beginner to python so as a small little project I made a quiz type game for my friends to try out and I could practice some python. I used pip and pyinstaller to turn my .py into a .exe but now I can’t for the life of me get my friends this file. Discord blocked it, gmail blocked it, I zipped it using regular zip and 7zip and tried uploading it to a google drive and sending them the link to it and it was blocked. They’re all flagging the file as a virus even though it’s just super basic python code and nothing malicious. How in the world can I get my friends this game? I know I could send them the .py but they’re not tech savvy and then they’d have to download python and I just know there has to be a way to do this. Thanks in advance!


r/pythonhelp • • Nov 29 '22

Need assist in creating python program that simulates a simple vending machine

3 Upvotes

I'm writing a script simulating a vending machine The program needs to be able to:

1.Display choices of snacks/drinks

2.State prices in malaysian ringgit (MYR)

3. Input money and calculate change return

4. Able to track inventory of the drinks and snacks remaining

5.Profits made from selling the snacks/drinks

________________________________________________________________________________________________________

I'm a total beginner at python and just started my Foundations in IT so this is the program i chose to try and a simulate for my end semester project. I chose a vending machine because it seemed like an interesting program to try and recreate .

I apologize but you have to treat me like I'm a total laymans. So far, I wrote a couple of lines that lists the amount of inventory I'm listing for sale and it's price. It's able to calculate change but at the moment it's not as comprehensive as I'd like.

I am aware that I need to create some kind of database to store all the information regarding inventory of snacks and drink types which I've no idea how to do

On top of that I also need help on writing a code that calculates a simulated input of cash and determine the amount of change it needs to return.

It should also be able to distinguish when it is deemed appropriate to return change in the form of either coins/notes. For example:Scenario 1:

Coke = 3 $ , Input money 4$ , Change 1$ in the form of 1$ notes

Scenario 2:Coke = 3.50$, Input money 10$ , Change: 6.50$ ( 1x5$ Note , 1x 1$ Note, 1x 0.50$ Coin)

Last but not least , the database that stores the data can be accessed using a certain passcode , which allows access to quantity of inventory sold / available plus profits/ revenue made total from price mockups.

Thank you so much in advance:

Here's some of the code I made so far.

https://pastebin.com/1rPd4d2e (Code properly formatted)


r/pythonhelp • • Nov 03 '22

Can't enter this SIMPLE case in a match statement

3 Upvotes
def on_press(key):
print(type(key))
x = str(key)
print (x, type(x))
match x:
    case 'w':
        print("stop")
        etc...

Output after pressing the 'w' key:

<class 'pynput.keyboard._win32.KeyCode'>
'w' <class 'str'>

No "stop" is printed, so it fails to enter the match case.


r/pythonhelp • • Oct 26 '22

what does that mean ?

3 Upvotes

what does x^=3 when x=5 mean ?

it evaluates to 6


r/pythonhelp • • Oct 25 '22

installing module proble.

3 Upvotes

Hi, this is so basic I feel foolish but I can't figure it out. I'm very new to python and I'm trying to install requests. I've tried both

python -m pip install requests

And

pip install requests

And

pip3 install requests

All give me an invalid syntax error and I am baffled.

Thanks!


r/pythonhelp • • Oct 11 '22

trying to make a Reimann sum program

3 Upvotes

Like I said the last time I posted here, I am new to python, so I am struggling more than I expected. I have experience in HTML, CSS, C++, C, C#, some Java, and some JavaScript.

# A function that is in charge of prompting the user for any input they
# give. It receives an argument representing the required data, prompts
# the user for that data, and then returns it to the calling statement.
def limits ():
    a = int(input("What is the value of \"a\":"))
    b = int(input("What is the value of \"b\":"))
    return a, b
# A function that is in charge of printing out the introductory
# statement(s) for the program.
def introduction():
    print("This progrram will calculate the integral of the function f(x) = 3x^3 - 2x^2 between user defined limits: a and b")
# A function that prints out the statement about the accuracy of delta.
def accuracy():
    print("The accuracy of this calculation depends on the value of delta that you use.")
    
# A function to evaluate the given mathematical formula at a given
# point. It takes a numerical argument that represents x, and returns
# the result of f(x).
def f(x):
    y = (3*(x**3))-(2(x**2))
    return y
# A function that calculates an approximation of the integral of f(x)
# using the riemann sum. It takes three arguments that represent the
# lower limit, the upper limit, and the delta value. It then returns the
# integral approximation as a result to the calling statement.
def integral(a, b, delta):
        integral = delta*(sum(a,b))

########################### MAIN ##################################
# In the space below, use the functions defined above to solve the
# problem.
###################################################################

# Print the introductory statements of the program
intro = introduction()
# Prompt the user for both the lower and upper limits
a , b = limits()

# Print the statements about delta
accuracy = accuracy()
# Promt the user for the delta value
delta = float(input("What is the value of \"delta\":"))
# Calculate the integral approximation
Area = integral(a, b, delta)
# Print out the result.
print(Area)

when I try to run this, my code gives me an error that reads:

Exception has occurred: TypeError
'int' object is not iterable
  File "C:\Users\rayro\OneDrive\Documents\Fall22\CSC 130\03 Riemann Sum.py", line 33, in integral
    integral = delta*(sum(a,b))
  File "C:\Users\rayro\OneDrive\Documents\Fall22\CSC 130\03 Riemann Sum.py", line 50, in <module>
    Area = integral(a, b, delta)

Edit: I went back and changed (a,b) in the integral variable definition to (f(a), f(b)). this is my new error code

Exception has occurred: TypeError
'int' object is not callable
  File "C:\Users\rayro\OneDrive\Documents\Fall22\CSC 130\03 Riemann Sum.py", line 26, in f
    y = (3*(x**3))-(2(x**2))
  File "C:\Users\rayro\OneDrive\Documents\Fall22\CSC 130\03 Riemann Sum.py", line 33, in integral
    integral = delta*(sum(f(a),f(b)))
  File "C:\Users\rayro\OneDrive\Documents\Fall22\CSC 130\03 Riemann Sum.py", line 50, in <module>
    Area = integral(a, b, delta)

r/pythonhelp • • Sep 30 '22

How do i parallelize this simple for loop?

3 Upvotes

I want to precompute a (symmetric) distance matrix to use it later for clustering with dbscan.

However already for a tiny 51x51 test matrix takes ~10min to calculate with the actual datasets i want to cluster being on the order of >2000 points which would take upwards of 10 days to compute.

Due to that i want to parallelize this if possible.

Currently the matrix is being build like this:

        precomputed = np.zeros((len(train_features), len(train_features)))
        for i in range(len(train_features)):
            logging.info(i)
            for j in range(i + 1, len(train_features)):
                precomputed[i][j] = self.trajectory_distance(
                    train_features[i], train_features[j], "geodesic"
                )
                precomputed[j][i] = precomputed[i][j]

I feel like this should be easily be parallelized using multiprocessing.pool but i seem to have a mental block right now.


r/pythonhelp • • Sep 26 '22

Can you burn a pygame code on a disk?

3 Upvotes

Thus is an absolutely reduculess question, but can you create a pygame and burn the information on a disk/flash drive? Then run the disk/flash drive on another PC without installing python?

No one needs to burn disks anymore, but this is just a reduculess question to see if this is even possible.


r/pythonhelp • • Sep 06 '22

How to add a term to an equation in Sympy.

3 Upvotes

I have an equation in Sympy, lets say it is :

Eq(x + 2)
How would I add another term to this like lets say I wanted to add the term x^2 so the equation would be:

Eq(x**2 + x + 2)


r/pythonhelp • • Aug 24 '22

Am I mocking correctly?

3 Upvotes

In my test I have:

def test_should_convert_csv_headers_to_array(mocker):

    expected = [ 'ID', 'Name', 'Image', 'SKU' ]
    mock_csv_dict_writer = mocker.MagicMock()
    mock_csv_dict_writer.fieldnames.return_value = [ 'ID', 'Name', 'Image', 'SKU' ]

assert expected == headers_to_config_map(mock_csv_dict_writer)

All headers_to_config_map does is call fieldnames on csv.DictWriter

I've mocked the csv dictwriter so the return value of calling feildnames returns the array I expect.

I'm just wondering if I'm moving in the right direction in terms of unit testing.

I can't help but think, this doesn't need to be tested because DictWriter.fieldnames() is already tested by the creators of the csv package. My function just wraps that so do I still need to test my function?


r/pythonhelp • • Aug 16 '22

UndefinedVariable issue in code.

3 Upvotes

Currently unable to run code due to throwing an undefined variable error. The "mod_emp_list" is whats giving the error, I'm relatively new to programming and would appreciate the help or tips to getting this figured out. I also added a link to show what the issue as well.

def main():  
mod_emp_list = to_mod_list(employee_list)  
print("Modified employee list: " + mod_emp_list + "\n")
print(f"List of usernames: {generate_usernames(mod_emp_list)}\n")
print(f"Initials and ids: {map_id_to_initial(employee_list)}")
if __name__ == "__main__":  
main()  

https://imgur.com/a/0tfADyC


r/pythonhelp • • Aug 13 '22

HOMEWORK How do I turn every value in a text file of integers into a list where each integer is its own value?

3 Upvotes

For example, let's say you're given a text file (txt.in)= ['100 5\n', '5 20\n', '9 40\n', '3 10\n', '8 80\n', '6 30']

Then, you are asked to turn txt.in into = [100,5,5,20,9,40,3,10,8,80,6,30]

However, I have found that no matter what I do it often turns into = ['100 5', '5 20', '9 40', '3 10', '8 80', ''6 30] and I don't know what to do.


r/pythonhelp • • Aug 11 '22

How is it possible that my "Print" and "Return" values are different, even though they're one after another? (Recursive function)

3 Upvotes

I'm writing a program for a game where 'num' coins are flipped, making a string "HHTT", "HTT", "TTT", etc. If one is heads, they flip again.

For each tails, I get a certain amount of "netmana". I'm trying to find the total netmana produced after all of the flipping.

My issue is that when I print "mana" at the end of the function, it's incorrect. But the 'return' value of mana is correct.

The code is as follows ("multiflips" function flips coins 'num' times and makes a string "HHT", "TTHH", etc.):

def flipmana(num, netmana):
    z = 0
    lst = multiflips(num)
    for i in range(len(lst)):
        if lst[i] == 'T':
            z += netmana
    return z

def keepflipping(num, netmana):
    z = 0
    lst = multiflips(num)
    for i in range(len(lst)):
        if lst[i] == 'T':
            z += netmana
    if 'H' not in lst:
        print("Mana: ", z)
        return z
    else:
        z += keepflipping(num, netmana)
        return z

My issue is that the code gives me this (My coinflip function prints each time):

>>>keepflipping(3,2)

Heads
Heads
Heads
Heads
Heads
Heads
Tails
Heads
Tails
Tails
Heads
Tails
Tails
Tails
Tails
Mana: 6
14

There are 7 tails, which give 2 netmana each, for a total of 14 mana, which is correct in the return function. Why is the print value different, even though it's 1 line after it in the code?

I also did a version with global variables and the print value was correct while the return value isn't! How could this be possible? Isn't z the same on both lines?


r/pythonhelp • • Aug 03 '22

encoding and decoding in python

3 Upvotes

I'm working on an encoder and decoder. my encoder works well however I can't seem to figure out how to make the decoder work. My encoder works by finding each letter's number in the alphabet. EG a = 1, b =2 and then times that number by a random number which is generated using a random.random() and a random.seed(my numbers), it then gets the last number of this float and uses it to get a letter from the dict.

Can anyone help me figure out how to get the decoder to work, if any more code or description is required please let me know?


r/pythonhelp • • Jul 26 '22

how to stop repeating a certain item in a list

3 Upvotes

So I am just messing around and trying to create a program that assigns certain people a task from a list.

lets say the list has 4 different tasks. I want to assign everyone 7 tasks from the list of 4, but I do not want to repeat one of those tasks once after it has already been assigned once (if that makes sense).

For right now what I have written is pretty basic, but not sure how to remove the "task 1" after it has already been assigned if that makes sense.

https://pastebin.com/gNyikkcB


r/pythonhelp • • Jul 03 '22

How do I delete lines consecutively in a text file?

3 Upvotes

I have been trying to make a password saver for a generator, and I want to delete lines consecutively in the file. Here is some of my code:

if occ >= 1:rewrite = input("Would you like to rewrite the password for:"+ reason+ "?\n")if rewrite == "yes":f = open(reason, "a+")f.truncate(0)f.close()os.remove(f)shutil.move('C:/Python Practice/Password-Generator-30-01-22/'+reason, 'C:/Python Practice/Password-Generator-30-01-22/Password file folder and generator')`


r/pythonhelp • • Jun 28 '22

Invalid syntax trying to yield one-line for loop

3 Upvotes

def yield_array(ar):

    for r in row_range:

        for c in col_range:

            yield(ar[r][c])

    [print(ar[r][c]) for r in row_range for c in col_range]

    [yield(ar[r][c]) for r in row_range for c in col_range] # invalid syntax?


r/pythonhelp • • Jun 14 '22

I have problems with my app

3 Upvotes

Hi guys im trying to make a Special app for my girl, im new to programming thats why it seems so bad designed but i have this last problem where i get a message, that says

in SubirDatos

conn.execute('UPDATE USUARIOS set Horas = inthorasEstudiadas WHERE Usuario = nomUser ;')

sqlite3.OperationalError: no such column: inthorasEstudiadas

I just want to update the data i get from my buttons and then put it in the database, but i get these Traceback error

from cProfile import label
from distutils.cmd import Command
from tkinter import ttk
from tkinter import *
from tkinter import font
import sqlite3
from unittest import TestCase
root = Tk()
root.title("Tabloid")
root.geometry("1006x800")
root['background']='#b78c83'
#FilaConValores = " "
#FilasVisibles= ""
#Data Base Programming:
#c.execute("""CREATE TABLE USUARIOS
#            (Usuario text,
#             Horas integer)
#            """)
conn = sqlite3.connect('Tabloid.db')
c = conn.cursor()

conn.commit()
conn.close()

#Entry
NombreEntry = Entry(root, width= 20)
#NombreUsuario = "Hola Escribe Tu Nombre"
#funciones
def CrearCuenta():  
global c
global row8_1
global contadorHoras
row8_1 = Label(root, text= NombreEntry.get() , font=("Arial", 17), bg="#b78c83").grid(column = 1, row= 8 )
global usuarioName
#Crear conexion
usuarioName= NombreEntry.get()
conn = sqlite3.connect('Tabloid.db')
#Crear Cursor
c = conn.cursor()
contadorHoras = 0
#Meter a la base de datos cierto dato
c.execute("INSERT INTO USUARIOS VALUES (:Usuario, :Horas)",
                {
'Usuario': NombreEntry.get(),  
'Horas': contadorHoras
                })
#HACER EL CAMBIO
conn.commit()
horas= Label(root, text= contadorHoras, font=("Arial", 17), bg="#b78c83").grid(column = 1, row= 22 )
def ingresar_a_Cuenta():
global c
global conn
global row8_1
global horas
row8_1 = Label(root, text= NombreEntry.get() , font=("Arial", 17), bg="#b78c83").grid(column = 1, row= 8 )
global usuarioName

conn = sqlite3.connect('Tabloid.db')
#Crear Cursor
c = conn.cursor()
#Meter a la base de datos cierto dato
c.execute("SELECT Horas FROM USUARIOS WHERE Usuario = :Usuario", {'Usuario':NombreEntry.get() })
#print(c.execute("SELECT Horas FROM USUARIOS WHERE Usuario = :Usuario", {'Usuario':NombreEntry.get() }))
#HACER EL CAMBIO
global contadorHoras
contadorHorasList=(c.fetchall())
contadorHoras1 = contadorHorasList
contadorHoras12 = contadorHoras1[0]
contadorHoras123 = str(contadorHoras12)
print(contadorHoras123)
string = contadorHoras123
characters = "[].,-()#"
for x in range(len(characters)):
string = string.replace(characters[x],"")
contadorHoras=int(string)
print(contadorHoras)
conn.commit()
#CERRAR CONEXIÓN
horas= Label(root, text= contadorHoras, font=("Arial", 17), bg="#b78c83").grid(column = 1, row= 22 )

def SumarH():
global horasEstudiadas
global contadorHoras
global horas
horasntesdesumar = int(contadorHoras)
horasEstudiadas = str(horasntesdesumar+1)
contadorHoras += 1
horas= Label(root, text= horasEstudiadas, font=("Arial", 17), bg="#b78c83").grid(column = 1, row= 22 )

def RestarH():
global horasEstudiadas
global contadorHoras
global horas
try:
if contadorHoras >0:
horasntesdesumar = contadorHoras
horasEstudiadas = str(horasntesdesumar-1)
contadorHoras -= 1
horas= Label(root, text= horasEstudiadas, font=("Arial", 17), bg="#b78c83").grid(column = 1, row= 22 )

except:
return

horas= Label(root, text= horasEstudiadas, font=("Arial", 17), bg="#b78c83").grid(column = 1, row= 22 )

def SubirDatos():
global horasEstudiadas
global contadorHoras
global horas
global c
global conn
global row8_1
global horas
nomUser= str(NombreEntry.get())
inthorasEstudiadas= int(horasEstudiadas)
conn.execute('UPDATE USUARIOS set  Horas = inthorasEstudiadas  WHERE Usuario = nomUser ;')

conn.commit()
#CERRAR CONEXIÓN

horas= Label(root, text= '0', font=("Arial", 17), bg="#b78c83").grid(column = 1, row= 22 )
#Botones
boton_nombre= Button(root, text = "Crear Cuenta", padx=0, pady= 0, font =( "Arial", 17), bg= "#baaf9b",command= CrearCuenta)
boton_subirDatos= Button(root, text= 'Actualizar Datos', font= ('Arial', 17),bg= "#baaf9b", command = SubirDatos)
boton_menosH = Button(root, text= '-', font= ('Arial', 17) ,bg= "#baaf9b", command= RestarH)
boton_masH = Button(root, text= '+', font= ('Arial', 17),bg= "#baaf9b", command= SumarH)
boton_Ingresar = Button(root, text= 'Ingresar', font= ('Arial', 17),bg= "#baaf9b", command = ingresar_a_Cuenta )
#Visualizar Botones
boton_nombre.grid(column=1, row= 23, padx= 0, pady=0)

boton_subirDatos.grid(column= 1, row = 24)
boton_masH.grid(column= 2, row = 22)
boton_menosH.grid(column= 0, row = 22)
boton_Ingresar.grid(column= 2, row = 23)
#Creación de Interface
row0 = Label(root,text ="-------------------------------------------||--------------------------------------||-------------------------------------------",
font=("Arial", 17), pady="0", bg= "#b78c83")
row1 = Label(root,text ="-------------------------------------------||--------------------------------------||-------------------------------------------",
font=("Arial", 17), pady="0", bg= "#b78c83")
row2= Label(root, text= "||      Hola Me Llamo Tabloid      ||",
font=("Arial", 17), pady="0", bg= "#b78c83")
row3= Label(root, text= "            4 Horas = Chocolate            ||     Soy Tu Nuevo Ayudante     ||            8 Horas = Ida a Gym            ",
font=("Arial", 17), pady="0", bg= "#b78c83")
row4= Label(root, text= "||           Yo Opero De La            ||",
font=("Arial", 17), pady="0", bg= "#b78c83")
row5= Label(root, text= "||          Siguiente Manera           ||",
font=("Arial", 17), pady="0", bg= "#b78c83")
row6 = Label(root,text ="-------------------------------------------||--------------------------------------||-------------------------------------------",
font=("Arial", 17), pady="0", bg= "#b78c83")  
row7 = Label(root,text ="-------------------------------------------||--------------------------------------||-------------------------------------------",
font=("Arial", 17), pady="0", bg= "#b78c83")
row8 = Label(root,text ="   5 Horas = PapasEstilo  ",
font=("Arial", 17), pady="0", bg= "#b78c83")
row8_2 = Label(root,text =" 9 Horas = Mix Dulces",
font=("Arial", 17), pady="0", bg= "#b78c83")
row9 = Label(root,text ="-------------------------------------------||--------------------------------------||-------------------------------------------",
font=("Arial", 17), pady="0", bg= "#b78c83")
row10 = Label(root,text ="-------------------------------------------||--------------------------------------||-------------------------------------------",
font=("Arial", 17), pady="0", bg= "#b78c83")
row11= Label(root, text= "||           Por Cierto Tiempo         ||",
font=("Arial", 17), pady="0", bg= "#b78c83")
row12= Label(root, text= "||        De Estudio dedicado        ||",
font=("Arial", 17), pady="0", bg= "#b78c83")
row13 = Label(root,text= "6 Horas = PyC    ||        A la semana Puedes        ||   10 Horas = Tiramisu",  
font=("Arial", 17), pady="0", bg= "#b78c83")
row14= Label(root, text= "  ||   Conseguir premios     || ",
font=("Arial", 17), pady="0", bg= "#b78c83")
row15 = Label(root,text ="-------------------------------------------||--------------------------------------||-------------------------------------------",
font=("Arial", 17), pady="0", bg= "#b78c83")
row17= Label(root, text= "||            La Mejor Oferta            ||",
font=("Arial", 17), pady="0", bg= "#b78c83")
row18 = Label(root,text = '7 Horas = SorpresaCh     ||      Aprendes Y ganas algo      ||      20 = SorpresaG          '
,font=("Arial", 17), pady="0", bg= "#b78c83")
row19 = Label(root,text ="-------------------------------------------||                                                   ||-------------------------------------------"
,font=("Arial", 17), pady="0", bg= "#b78c83")
row20 = Label(root,text ="-------------------------------------------||--------------------------------------||-------------------------------------------",
font=("Arial", 17), pady="0", bg= "#b78c83")
#row22 = Label(root,text = "", bg= "#b78c83")

#Visualización Interface
row0.grid(column= 0,row=0, columnspan=3)
row1.grid(column= 0,row=1, columnspan=3)
row2.grid(column= 0,row=2, columnspan=3)
row3.grid(column= 0,row=3, columnspan=3)
row4.grid(column= 0,row=4, columnspan=3)
row5.grid(column= 0,row=5, columnspan=3)
row6.grid(column= 0,row=6, columnspan=3)
row7.grid(column= 0,row=7, columnspan=3)
row8.grid(column= 0,row=8)
row8_2.grid(column= 2,row=8)
row9.grid(column= 0,row=9, columnspan=3)
row10.grid(column= 0,row=10, columnspan=3)
row11.grid(column= 0,row=11, columnspan=3)
row12.grid(column= 0,row=12, columnspan=3)
row13.grid(column= 0,row=13, columnspan=3)
row14.grid(column= 0,row=14, columnspan=3)
row15.grid(column= 0,row=15, columnspan=3)
row17.grid(column= 0,row=17, columnspan=3)
row18.grid(column= 0,row=18, columnspan=3)
row19.grid(column= 0,row=19, columnspan=3)
row20.grid(column= 0,row=20, columnspan=3)
#row22.grid(column= 0,row=22)
NombreEntry.grid(column=0, row=23, padx=10, pady=10 )

root.mainloop()


r/pythonhelp • • Jun 12 '22

Trying to check if a value is a positive integer, what am I doing wrong? Getting 'True' for all values. Thank you!!!

3 Upvotes
def isPosInt(val):
    if type(val) == int:
        return True
    else:
        if int(val) >= 0:
            return True
        else:
            return False
        
isPosInt(-5)

r/pythonhelp • • May 26 '22

what python compilers should I use?

3 Upvotes

I am looking for a new IDE and Pycharm is very good, however If there are other IDE's please let me know.

*in this post "compilers" are the same as IDE