r/PythonLearning 6d ago

my first python

Post image

kindly give ratings and tips to improve

24 Upvotes

29 comments sorted by

7

u/Ok_Reputation8316 6d ago

Did you run this? input() returns strings, so you’re adding and dividing strings instead of numbers. Also, what’s the ultimate variable for?

1

u/realmauer01 5d ago

Overloaded math symbols for the win.

-6

u/saul_soprano 6d ago

no its hypothetical

11

u/Turbulent-Jackfruit5 6d ago

Wym “hypothetical” why not run your code 💀

2

u/TrieMond 5d ago

I assume he is talking about the variable being hypothetical, not the code as a whole...

1

u/fizzy_lychee 5d ago

Why so many downvoting this?

6

u/arivictor 6d ago
print("""
This is...


A lot of...


text...
""")

5

u/mc_pm 6d ago

Best "Hello World" today!

3

u/SCD_minecraft 6d ago

This has so many problems

  1. Comments are annotated with #, not //. Double slash is reserved for int division

  2. input ALWAYS returns a string. While you can add 2 strings together, you might not divide one string by another. You need to cast to an int

  3. ultimate variable is never read

  4. Whatever extension did you install, it is not a correct one. Syntax highlither highlights things it isn't supposed to

1

u/SCD_minecraft 6d ago

Half of those problems would come out while trying to run this code

Did you even try that??

1

u/Hurtrex 5d ago

to quote him "no its hypothetical" which yk doesnt really help if you want to learn something...

1

u/SCD_minecraft 5d ago

``` from Minecraft import main

main() ```

I made (hypothetical) Minecraft!

5

u/AbacusExpert_Stretch 6d ago

Rating 1 of 5 - for not running your code.

2

u/HammadBuilds 6d ago

you can't feel your program untill you run the code man.

3

u/Distinct_Lion7157 6d ago

is nobody going to address the //

2

u/Distinct_Lion7157 6d ago

ok on closer inspection there is a lot more issues so uh good luck bro

1

u/Less_Juggernaut9361 6d ago

May i suggest using multi line string with “”” then you not need to print so many times

1

u/Small_Strawberry2147 6d ago

only study"print" is also good starting point! keep going!

1

u/Far-Albatross1351 5d ago

You should run your codes when you write

1

u/FoolsSeldom 5d ago

Wow, not a great start.

// hello world             # Python single line comments start with #
print("Hello, World!")

// arithmetic
a = input("give number 1")  # input returns reference to new string object
secret = input("give secret number")
ultimate = a + secret  # string concatenation not math addition, is that what you wanted?
print("the secret number is" + secret / a)

// hello
print("hello " + input("name please"))

print("i would like to take this time to raise awareness")
print("my brother patel lost an arm learning python")
print("the python was cursed long ago with immortality and doom magic")
print("once it saw patel learn cpp and use namespace std it awakened")
print("cupta, the snake bit his arm", end="") // no newline  # need a # not //
print("the eyeless priest from the dark magic days of india was sealed")
print("his soul became evil and sought refuge in patels arm")
print("his arm grew corrupted and started typing in java")
print("the doctor said no use and severed his arm feeding it to the pigs to be destroyed")
print("be careful when coding")

// happy coding
print("happy coding")

1

u/Due-Construction7148 5d ago

Ms word would be the fitting choice

1

u/alneifkrt2 3d ago

Bro the comments are not like C . It's # to comment or ""

1

u/alneifkrt2 3d ago

If I was to rate your code 0-10, I would give 2. Sorry but the logics are not correct, the comments are # or "" not //, and you can't sum or divide strings. So review and try to figure out.

Good learning 🐍

1

u/SitEnee 1d ago

Try to run your code after you write it to check if it will work (this won't). If you just type the code and don't check how everything behaves, you won't learn properly the syntax and stuff. Cool that you're learning tho.

0

u/Correct-Purple-9188 4d ago

Could have just did \n for all then prin ts no?

-1

u/Necessary_Pepper7111 6d ago

i dont know but i think double quotes does not work in python

1

u/Necessary_Pepper7111 6d ago

nvm thinking of cpp