#π yo what should i learn nexts
83 messages Β· Page 1 of 1 (latest)
@cold smelt
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
what are you learning python for?
like my first goal is to make an app or a ai
what kind of app?
chatbot or nureal network
What other interests do you have? Anything that you can find an overlap with python for?
like
If you like cooking for example, maybe a recipe organizer or measurement converter
like 3 months
i learned arrasy if stats for loops while loops
string string manu
and binary search
Variable Assignment
Receiving Input
Type Conversion
Strings
Formatted Strings
String Methods
Comments
Arithmetic Operations
Math Functions
If Statements
Logical Operators
Comparison Operators
While Loops
For Loops
Nested Loops
Lists
2D Lists
List Methods
Tuples
Dictionaries
Functions
Parameters/Arguments
Return Statement
Exceptions
Generating Random Values
File Handling
Classes
This is a list of what I'd consider "the basics" that everyone needs to learn
can you share your calculator code?
kkay
i made chatbot i still dont know how to train the little idoit of mine
same problem
from tkinter import *
root = Tk()
root.title("calculater i think with gui not terminal")
e = Entry(root,width=35 , borderwidth= 5)
e.grid(row=0,column=0,columnspan=3,padx=5 ,pady = 5)
def button_click(number):
current = e.get()
e.delete(0,END)
e.insert(0,str(current) + str(number))
def button_clear():
e.delete(0, END)
def button_add():
first_num = e.get()
global ft_num
global math
math = "add"
ft_num = int(first_num)
e.delete(0,END)
def button_equal():
second_number = e.get()
e.delete(0,END)
if math == "add":
e.insert(0,ft_num + int(second_number))
if math == "sub":
e.insert(0,ft_num - int(second_number))
if math == "div":
try:
e.insert(0,ft_num / int(second_number))
except ZeroDivisionError:
e.insert(0,"erore code 0 zero divison")
if math == "multi":
e.insert(0,ft_num * int(second_number))
def button_multi():
first_num = e.get()
global ft_num
global math
math = "multi"
ft_num = int(first_num)
e.delete(0,END)
def button_sub():
first_num = e.get()
global ft_num
global math
math = "sub"
ft_num = int(first_num)
e.delete(0,END)
def button_div():
first_num = e.get()
global ft_num
global math
math = "div"
ft_num = int(first_num)
e.delete(0,END)
Hey @cold smelt!
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
perfect
print('yay')
this might be a good time to learn that you can create buttons using loops π
what...
which do you think?
for loop lol
when do you use for and when do you use while?
not quite the correct way to think about them
while is when we don't know immediately when the loop should end
it is called an "indefinite loop"
and to iterate a string an arrays
for is when we want to apply something a fixed number of times (like once per object in a list)
k
it is called a "definite loop"
kay
we know we want 10 numbered buttons, therefore, we should use for
import tkinter as tk
root = tk.Tk()
for i in range(9):
btn = tk.Button(text=str(i + 1), padx=15, pady=15)
btn.grid(row=i // 3, column=i % 3, padx=2, pady=2)
root.mainloop()
try running this
you can still add the remaining buttons without the loop
but this definitely saves from repeating for the number buttons
yea i came back'
Did you have any other questions?
Nothing much
If that's all for now then, you can close this help thread with !close
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.