Jump to content

What is the problem in this python code

TheGrim123321
3 minutes ago, SSL said:

 

Yes.

 

 

I think you should write out what you want out what you want to happen in plain English (or whatever language you prefer). Then translate that to Python. I could just tell you what to code, but I don't think will help you learn.

 

I will suggest that "operator" or "operation" would be a clearer variable name than "function".

 

3 minutes ago, ElfFriend said:

Here's what I'd do:


[code]
number_1 = int(input('Enter a number: '))
number_2 = int(input('Enter a second number: '))
function = int(input('1. Addition'))
if function == 1 :
   print (number_1+number_2)
[/code]

Thanks for the help :D

TheGrim123321

CPU: I3-4170Cooler: Hyper TX3Mobo:Biostar B85MGMemory: G.Skill Ripjaw 2x4GBStorage: Barracuda 500GBGPU: Zotac GTX660Case: Fractal 1100PSU: Evga 500WMonitors: FHX2153L 21.5"│V193WEJb 19"Keyboard/Mouse: CMStorm DevastorAudio: MonoPrice 8323Microphone: BlueYeti BlackoutOS: MSX(Win10) Quote me or @TheGrim123321 to get my attention.
Link to comment
Share on other sites

Link to post
Share on other sites

Make sure you understand why it works. And try to use better variable names like SSL suggested.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, ElfFriend said:

Make sure you understand why it works. And try to use better variable names like SSL suggested.

Yeah I understand how the one you suggested works and I'll work on using better names

TheGrim123321

CPU: I3-4170Cooler: Hyper TX3Mobo:Biostar B85MGMemory: G.Skill Ripjaw 2x4GBStorage: Barracuda 500GBGPU: Zotac GTX660Case: Fractal 1100PSU: Evga 500WMonitors: FHX2153L 21.5"│V193WEJb 19"Keyboard/Mouse: CMStorm DevastorAudio: MonoPrice 8323Microphone: BlueYeti BlackoutOS: MSX(Win10) Quote me or @TheGrim123321 to get my attention.
Link to comment
Share on other sites

Link to post
Share on other sites

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, SSL said:

Some interesting things to think about later (google):

Bookmarked for later

TheGrim123321

CPU: I3-4170Cooler: Hyper TX3Mobo:Biostar B85MGMemory: G.Skill Ripjaw 2x4GBStorage: Barracuda 500GBGPU: Zotac GTX660Case: Fractal 1100PSU: Evga 500WMonitors: FHX2153L 21.5"│V193WEJb 19"Keyboard/Mouse: CMStorm DevastorAudio: MonoPrice 8323Microphone: BlueYeti BlackoutOS: MSX(Win10) Quote me or @TheGrim123321 to get my attention.
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×