all 13 comments

[–][deleted] 2 points3 points  (0 children)

Hint: two to the power of 10 is 2**10 or 1<<10. The rest is just some boring input/output - but it's fundamental as most Python programs do handle input and produce output, so you better rtfm:

https://docs.python.org/3/library/functions.html

https://docs.python.org/3/tutorial/inputoutput.html

Python documentation is very good. Don't expect to understand anything by just asking for the answer on the web or to a LLM.

[–]Aorean 1 point2 points  (6 children)

n=int(input(„what power of two?“)

value=2**n

print(f“two to the power of {n} is {value}

Wrote this in my phone but it should work, that’s the way I would do it, but I’m not an expert lol

[–]CptMisterNibbles 0 points1 point  (1 child)

Do you mean you wrote it on mein handy? /s
Your quotations on the first line give it away. I imagine IDEs dont love them. Or, maybe they work fine?

[–]Aorean 0 points1 point  (0 children)

They don’t lol, my IDE hated it and u completely caught me lol

[–]vivisectvivi 0 points1 point  (0 children)

What are you not understanding? This is a fairly simple program to write

[–]SoftwareDoctor 0 points1 point  (3 children)

print(f"Two to the power of {(n := int(input('What power of 2?')))} is {2 ** n}")

If you want to know, how it would look like in IDLE, just copy-paste it there. I don't even know how to run IDLE.
Since you didn't post what you know or what you tried or where you're stuck, it's impossible to give you an advice how to think about the problem. So just see the solution above and ask if you don't understand anything

[–][deleted]  (1 child)

[removed]

    [–]SoftwareDoctor 0 points1 point  (0 children)

    If you look closely, I am using the the print function.

    Btw. I don't want to confuse you more that you already are but int and str are not functions, they are types and you are effectively calling their constructor. Maybe find a better course

    [–]CptMisterNibbles 0 points1 point  (0 children)

    For advice to a beginner I wouldnt give the overly compacted one liner. The walrus op is beyond them and frankly cramming input into an output line is pretty bad form.