|
| 1 | +# Check user age group |
| 2 | +# user_input = input('Enter your age:\n') # Get input as string |
| 3 | +# user_Age = int(user_input) # Convert to integer |
| 4 | +user_Age = 20 # Example age, replace with input if needed |
| 5 | +if user_Age < 13: |
| 6 | + print('Children') |
| 7 | +elif user_Age <= 19: |
| 8 | + print('Teenager') |
| 9 | +elif user_Age <= 59: |
| 10 | + print('Adult') |
| 11 | +else: |
| 12 | + print('Senior') |
| 13 | + |
| 14 | +######################################################### |
| 15 | + |
| 16 | +# Give 2ドル discount on Wednesday for ticket pricing |
| 17 | +age = int(input('Sir, what is your age: ')) |
| 18 | +day = 'Wednesday' |
| 19 | +price = 12 if age >= 18 else 8 |
| 20 | +if day == 'Wednesday': |
| 21 | + price -= 2 |
| 22 | +print('Ticket price for you is: $', price) |
| 23 | + |
| 24 | +#################################################################### |
| 25 | + |
| 26 | +# Grading system |
| 27 | +marks = int(input('Your marks: ')) |
| 28 | +if marks <= 100: |
| 29 | + if marks >= 90: |
| 30 | + print('A Grade') |
| 31 | + elif marks >= 80: |
| 32 | + print('B Grade') |
| 33 | + elif marks >= 70: |
| 34 | + print('C Grade') |
| 35 | + elif marks >= 60: |
| 36 | + print('D Grade') |
| 37 | + else: |
| 38 | + print('F') |
| 39 | +else: |
| 40 | + print('Enter marks between 0 to 100') |
| 41 | + |
| 42 | +##################################################################### |
| 43 | + |
| 44 | +# Banana ripeness check based on color |
| 45 | +condition = input('Enter banana color (Green, Yellow, Brown): ') |
| 46 | +if condition == 'Green': |
| 47 | + print('Banana is unripe') |
| 48 | +elif condition == 'Yellow': |
| 49 | + print('Banana is ripe') |
| 50 | +elif condition == 'Brown': |
| 51 | + print('Banana is overripe') |
| 52 | +else: |
| 53 | + print('Please enter only Green, Yellow, or Brown') |
| 54 | + |
| 55 | +######################################################################## |
| 56 | + |
| 57 | +# Suggest activity based on weather |
| 58 | +weather = input('Enter weather (Rainy, Sunny, Snowy): ') |
| 59 | +if weather == 'Rainy': |
| 60 | + print('Read a book') |
| 61 | +elif weather == 'Sunny': |
| 62 | + print('Go for a walk') |
| 63 | +elif weather == 'Snowy': |
| 64 | + print('Build a snowman') |
| 65 | +else: |
| 66 | + print('Enter only Rainy, Sunny, or Snowy') |
| 67 | + |
| 68 | +######################################################### |
| 69 | + |
| 70 | +# Transport mode selection based on distance |
| 71 | +distance = int(input('Enter the distance (in km): ')) |
| 72 | +if distance <= 3: |
| 73 | + travel = 'Walk' |
| 74 | +elif distance <= 15: |
| 75 | + travel = 'Use Bike' |
| 76 | +else: |
| 77 | + travel = 'Use Car' |
| 78 | +print(travel) |
| 79 | + |
| 80 | +########################### |
| 81 | + |
| 82 | +# Coffee order with optional extra shot |
| 83 | +order_size = 'Medium' |
| 84 | +extra_shot = True |
| 85 | +if extra_shot: |
| 86 | + coffee = order_size + ' coffee with extra shot' |
| 87 | +else: |
| 88 | + coffee = order_size + ' coffee' |
| 89 | +print(coffee) |
| 90 | + |
| 91 | +########################### |
| 92 | + |
| 93 | +# Check password strength |
| 94 | +password = input('Enter your password: ') |
| 95 | +password_length = len(password) |
| 96 | +if password_length <= 6: |
| 97 | + check = 'Weak' |
| 98 | +elif password_length <= 10: |
| 99 | + check = 'Medium' |
| 100 | +else: |
| 101 | + check = 'Strong' |
| 102 | +print('Password strength:', check) |
| 103 | + |
| 104 | +########################### |
| 105 | + |
| 106 | +# Check if a year is a leap year |
| 107 | +year = int(input('Enter the year: ')) |
| 108 | +if (year % 400 == 0) or (year % 4 == 0 and year % 100 != 0): |
| 109 | + print(year, 'is a leap year') |
| 110 | +else: |
| 111 | + print(year, 'is not a leap year') |
| 112 | + |
| 113 | +####################################### |
| 114 | + |
| 115 | +# Suggest food to animals based on age |
| 116 | +dog = True |
| 117 | +dog_age = 1 |
| 118 | +cat = True |
| 119 | +cat_age = 4 |
| 120 | + |
| 121 | +if dog and dog_age <= 2: |
| 122 | + print('Puppy food to dog') |
| 123 | +if cat and cat_age <= 5: |
| 124 | + print('Senior food to cat') |
0 commit comments