Coder Social home page Coder Social logo

pythonexercies's People

Contributors

supercool-coder avatar

Watchers

 avatar

pythonexercies's Issues

python nested if issue

``I am a beginner who is still learning how to use python syntax.I tried to write codes using if conditions as exercising but I had an issue.
the idea of the code is to write a program that allows the user to enter his country and the course he wants to apply for then the program will give him a discount regarding this information.

issue: the issue is every time I write ksa as the input it gives me a discount for Canada and I don't know why.

code ==>
`name=input("enter your name\n")
country=input("enter your country\n").strip()
course=input("enter your course\n")

studentcheck=input("Are you student ?\n")
prcice=100
if (country=="Canada" or "canada") and (course=="python"):
if studentcheck=="yes":
print(f"Hello {name} from {country}")
print(f"you course will be 10$")
elif studentcheck=="no":
print(f"Hello {name} from {country}")
print(f"you course will be 20$ ")
else :
print("you don't have discount from USA")
elif (country=="ksa") and (course=="python"):

if studentcheck=="yes":
    print(f"Hello {name} from {country}")
    print(f"you course will be 30$")
elif studentcheck=="no":
    print(f"Hello {name} from {country}")
    print(f"you course will be 40$ ")
else :
    print("you don't have discount from KSA")

else:
print("No discounts")

`

nested if issue

`I am a beginner who is still learning how to use python syntax.I tried to write codes using if conditions as exercising but I had an issue.
the idea of the code is to write a program that allows the user to enter his country and the course he wants to apply for then the program will give him a discount regarding this information.

issue: the issue is every time I write ksa as the input it gives me a discount for Canada and I don't know why.
if1
if2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.