Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions Python Codes/If-Else_Example.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
N = int(input())
if N % 2 != 0:
print ('Weird')
else:
if N >= 2 and N <= 5:
print ('Not Weird')
elif N >= 6 and N <= 20:
print ('Weird')
elif N > 20:
print ('Not Weird')
# To check whether a user is eligible to vote or not

user_name = input("Enter your name")
user_age = int(input("Enter your age"))

if user_age >= 18:
print(f"{user_name} is eligible for voting"})

elif user_age < 18:
print(f"{user_name} is not eligible for voting as they should be atleast 18 years or older not {user_age}")