• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Tutorials for python

tigris649

Member
Hi I'm new to programming and I've been reading over the programming section here for awhile, to find out more about programming and which language I should learn. I chose to go with python because many people here said it is a good language to start with. So I've downloaded it and am ready to try it out. Now I've googled "python tutorials" but i do not know which one to use. I was wondering if any you all could recommend me a good tutorial for python beginners.

Thanks
 
Well I decided to go with this tutorial Texthttp://www.upriss.org.uk/python/session1.html other one seemed to complicated. I need help on this exercise I'm working on though. The exercise is to Write a script that asks a user for a number. The script adds 3 to that number. Then multiplies the result by 2, subtracts 4, subtracts twice the original number, adds 3, then prints the result.

I cannot figure out how to get it to subtract twice the original number :/

here is my code so far

number = input ("Please input a number")
a = number
a = (a + 3) * 2 - 4
print a

what do I need to do to subtract twice the original number?
 
Is this the correct order of operations for that exercise?

In any case you subtract twice the original number by: -2*original variable name

number = input("Please input a number")
a = ((2*(num+3)-4)-2*num)-3
print a
 
Originally posted by: Dimmu
Is this the correct order of operations for that exercise?

In any case you subtract twice the original number by: -2*original variable name

number = input("Please input a number")
a = ((2*(num+3)-4)-2*num)-3
print a

Yep thats it thanks Dimmu
 
Originally posted by: tigris649
Originally posted by: Dimmu
Is this the correct order of operations for that exercise?

In any case you subtract twice the original number by: -2*original variable name

number = input("Please input a number")
a = ((2*(num+3)-4)-2*num)-3
print a

Yep thats it thanks Dimmu

No worries. Happy to help.
 
Originally posted by: kamper
There are at least two bugs in that code (exercise for tigris to find them 🙂)

Do you mean how Dimmu put "num" instead of "number"? If so then I recognized that 😀 and changed it to number when writing the program.
 
Originally posted by: tigris649
Originally posted by: kamper
There are at least two bugs in that code (exercise for tigris to find them 🙂)

Do you mean how Dimmu put "num" instead of "number"? If so then I recognized that 😀 and changed it to number when writing the program.

Haha. I didn't even realize that until it was pointed out. I copied your original code, but only kept the first line and wrote the out the other two. 😱
 
Uh, never mind, I totally didn't read the documentation for input() well enough and imagined a bug where there wasn't one. 😱

But yeah, num/number was the obvious real one...
 
Back
Top