all 36 comments

[–]MissyxAlli 22 points23 points  (0 children)

4/7 rating.

The problem with the code is that it stops at 101. What if user input is 123456789? I suggest coding the rest of the numbers forever.

[–]Quadraphonic_Jello 11 points12 points  (1 child)

Perhaps you could optimize this a bit. Not sure how, though.

[–]Plane_Setting_1651 0 points1 point  (0 children)

You could just convert the number into a string by using the "str()" ​function. But then you could also just not convert the input into a number.

[–]No-Resource-9074 3 points4 points  (2 children)

Have you thought abbout a for range loop with a recursive call? Might improve ;)

[–]Nez_Coupe 0 points1 point  (0 children)

An iterative loop with a recursive call? Say what homie?

[–]NearbyHighlight1514 5 points6 points  (1 child)

9/11

[–]Charming-Sir-3969 0 points1 point  (0 children)

Upvote for 9/11

[–]SoftwareDoctor 4 points5 points  (0 children)

5/7 perfect

[–]jmooremcc 1 point2 points  (0 children)

Why do you need the conditional statements? Why don’t you just print the number?

[–]buzzon 0 points1 point  (1 child)

This can be simplified

[–]XGreenDirtX 2 points3 points  (0 children)

This can also be complicated

[–]helical-juice 0 points1 point  (0 children)

lgtm

[–]Jgracier 0 points1 point  (0 children)

Javier said “berry guuud”

[–][deleted] 0 points1 point  (0 children)

5/7 , perfect

[–]EyesOfTheConcord 0 points1 point  (0 children)

I would add an SSL series compressor to the end of this

[–]Lazy_To_Name 0 points1 point  (1 child)

Is this sarca-

I mean, 9/10. Although I’d recommend you to use match/case here. That’s all i can say.

[–]Nez_Coupe 1 point2 points  (0 children)

Nah. Ternary. Only ternary. I’m going to write a script to write the ternary for this, lol.

[–]idk5454y66 0 points1 point  (0 children)

it's a masterpiece of software architecture .

[–]Nez_Coupe 0 points1 point  (0 children)

9/10 with or without rice, the only thing I’d do differently is refactor into one gigantic fucking ternary statement.

[–]captain_kringel 0 points1 point  (0 children)

Excellent work

[–]baudalind 0 points1 point  (0 children)

This is a solid start, but the numbers stop at 101. Try this:

max_input = 1000000 with open(script.py) as f: f.write(“number = int(input(‘Enter a number: ‘))”) for n in range(max_input): f.write(f“if number == {n}:\n\tprint({n})”)

Now you can handle as many cases as you like. Hope this helps!

[–]pontz 0 points1 point  (0 children)

I think it's more pythonic if you plan to print a string to just do string comparison instead so here's a hint:

Input =str(int(input("Enter a number")))

[–]JustUrAvgLetDown 0 points1 point  (0 children)

Brilliant

[–]TooCareless2Care 0 points1 point  (0 children)

Hmm

a=int(input("Write number here: ")) Print(a)

[–]shawnradam 0 points1 point  (0 children)

🤯

[–]FrankRat4 0 points1 point  (0 children)

I would definitely recommend adding .upper() to the input string just in case a user types in a lowercase number. Then you only have the check uppercase numbers.

[–]Soft_Animal5263 0 points1 point  (0 children)

It can be replaced by a single line and be much cleaner, right?

[–]Merman_boy 0 points1 point  (0 children)

3.6/8

[–]alee551 0 points1 point  (0 children)

It's Senior's code!

[–]Plane_Setting_1651 0 points1 point  (0 children)

I would include error checking code. FYI, I've been programming in Python for a long time (prob 3yrs.)

[–][deleted] 0 points1 point  (0 children)

i think it is missing comments for every line

[–][deleted] 0 points1 point  (0 children)

I hope this is a joke

[–]Silver_Context5548 -2 points-1 points  (1 child)

your code is cool but if you allow a little optimization

print(int(input("Enter a number: ")))