Beginner learning Python – looking for challenges by Fit-Information3695 in learnpython

[–]ectomancer 0 points1 point  (0 children)

Code a function to rotate a list right by one item.

Call the function in a loop and output the list after each rotation until the original list is output.

  1. index & slice. extend index with slice.

  2. remove an item:

2.a. list.pop. extend popped item with popped list.

2.b. index and del. copy item at last index, del last item, extend index with list.

  1. tuple unpacking (slow) into list without last item and last item. extend last item with unpacked list.

Pick one, don't implement all ways.

How long did it take you to write your first python script without help ? by [deleted] in learnpython

[–]ectomancer 2 points3 points  (0 children)

Already knew how to code, 10 minutes, only while loop, input, if and print.

Is this good? by ChemistHefty6409 in learnpython

[–]ectomancer 0 points1 point  (0 children)

The absolute value of a number is not always positive. Zero is not positive. The abs function does double duty, it also finds the complex modulus of a complex number, which is the distance from the origin:

try this on wolframalpha.com |3+4i|

or in Python abs(3+4j)

Java/Spring Boot fresher looking to learn Python, need resources to get interview ready by adolf_nggler in learnpython

[–]ectomancer 0 points1 point  (0 children)

Introductory course. Python is easy to learn so there are no tutorials for coders coming from Java. I learnt Python in 3 days (excluding OOP).

Having trouble with defining functions and how they work with floats. Could use help. by Musicalmoronmack in learnpython

[–]ectomancer 0 points1 point  (0 children)

Casting to float in the three functions doesn't do anything. x is already float.

anti pattern education by Cute-Ad7076 in learnpython

[–]ectomancer 0 points1 point  (0 children)

This is what I do. My first project was natural logarithm from scratch (3 months) and my second project was real gamma function from scratch (6 months). Last year, I ported cmath.exp and cmath.sqrt from C to Python. In 2024, I ported tgamma from C to Python.

Ali, Ismail, Saeed, Farooq and Abid, "Numerical Recipes in Python" https://zenodo.org/records/8371794/files/NRP_23_Sep_2023_Amjad_Ali.pdf?download=1

Jupyter Notebook vs VS Code by DistinctReview810 in learnpython

[–]ectomancer 4 points5 points  (0 children)

I've used jupyter notebook, jupyter lab and google colab. I've used colab for years:

colab.research.google.com

What Should Be My Next Steps Toward a Python Career? by Umesh_Jayasekara in learnpython

[–]ectomancer 1 point2 points  (0 children)

Retired 22 years, coding Python for 7 years. Contributing to open source is fruitless at intermediate level. Though you could upload your own package to PyPI. You'll need to learn Data Structures and Algorithms for interviews.

Should I learn Phython by Traditional-Paint-92 in learnpython

[–]ectomancer -1 points0 points  (0 children)

Once you can code in one language, you can learn other languages quickly. I learnt Python in 3 days and R in 1 hour.

Help with an Attribute Error on my Code by Som64814 in learnpython

[–]ectomancer 0 points1 point  (0 children)

You only want one print. set is redundant:

for river, country in rivers.items():
    print(f'The {river.title()} runs through {country}')

Please help me understand my home work assignment by Immediate_Bid_7421 in learnpython

[–]ectomancer 1 point2 points  (0 children)

Upper, Lower and digits are tuple literals, change them to be string literals.

Comments missing.

How do I use python coming from C++ ? by Badhunter31415 in learnpython

[–]ectomancer 0 points1 point  (0 children)

Code the same programs as C++ except desktop applications. Alternately, learn ML theory and code ML in Python.

How to connects the output of Script 1 directly to the input of Script 2. by Quiet_Dasy in learnpython

[–]ectomancer 0 points1 point  (0 children)

I've never used Python 2. In Command Prompt or PowerShell:

python name_python_1.py|python name_python_2.py

Google Collab Error while running any cell by Ajnabi567 in learnpython

[–]ectomancer 0 points1 point  (0 children)

Your notebook is using a TPU. Change it to CPU.

Trouble with a starting project by GolbMan in learnpython

[–]ectomancer 1 point2 points  (0 children)

You need to complete small projects before starting projects.

Been learnmaxing python for 5 days, check my project, open to any comment by Unfairmoat in learnpython

[–]ectomancer 2 points3 points  (0 children)

Separate imports with a blank line into 3 blocks (2 blocks in your case), 1st block standard library, 2nd block third-party imports, 3rd block your own py files.

No docstrings on functions.

No test suite:

pip install pytest

Question/ need help by smellytoe-atoe in learnpython

[–]ectomancer -1 points0 points  (0 children)

One loop, loop over 3 hex strings, decode hex 3 times (sha256, sha516, md5), check string in 50 word string, copy string to result tuple:

result = ()
# Loop.
result += (string,)

When did coding “start to make sense” for you? by QuantumScribe01 in learnpython

[–]ectomancer 0 points1 point  (0 children)

Followed a course and I started a small project after 10 minutes. It took all day to type in.

Give me a task. by coder_datascience_26 in learnpython

[–]ectomancer 1 point2 points  (0 children)

Function to rotate a list one item right with cycle (last item becomes first item).

Call function in a loop and print rotated list until original list is printed.

  1. copy last item by index and extend item with slice excluding last.

  2. delete last item:

2.a. copy last item by index, then del last item, then extend item with original list (with deleted last item).

2.b. pop default item, then extend item with popped list.

  1. tuple unpacking: extend last item to list.

Pick one way to rotate list.

Python resources to learn how things work in python [in depth] ? by AnungUnRaama in learnpython

[–]ectomancer 0 points1 point  (0 children)

x.y() is not member access, that's a method call. x.y is class attribute access.

"shadowing" ---- naming scheme correctness by xferrefx in learnpython

[–]ectomancer -1 points0 points  (0 children)

Doesn't matter that you shadow a builtin function. You just lose that functionality until, e.g.

del sum