pythonexercies's People
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")
`
Python beginners Exercise
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.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.