问:
What can I do to be able to have numbers with no symbols?
What is wrong with my code? I started python a few weeks ago, and I am trying to make a random password generator that is customisable. I want to give the user options to have it fully capitalised, fully lowercase or normal (each different word capitalised at the start). I also want them to have the option to have numbers or symbols or not. Every time I run the program, it does not let me have numbers with no symbols. What is wrong?

to the people who just replied saying to show the error and stuff, I literally just signed up for stack overflow and it says that I cant upload pictures yet how can I do that

```<code>import random

def password():
    normal_adjectives = ['Funny', 'Amazing', 'Infinity', 'Fabulous', 'Red', 'Rainbow', 'Adorable', 'Adventurous', 'Impressive', 'Determined',
                  'Delighted', 'Scary', 'Active', 'Distinct', 'Eager', 'Elegant', 'Excited', 'Enchanted', 'Fair', 'Fierce', 'Fancy',
                  'Gentle', 'Glamorous', 'Graceful', 'Happy', 'Handsome', 'Hungry', 'Fluffy', 'Important', 'Itchy', 'Impossible',
                  'Jealous', 'Joyous', 'Jolly', 'Kind', 'Caring', 'Lazy', 'Lonely', 'Lucky', 'Lovely', 'Magnificent', 'Modern',
                'Mysterious', 'Naughty', 'Nervous', 'Nice', 'Obnoxious', 'Outrageous', 'Outstanding', 'Perfect', 'Pleasant',
                'Powerful', 'Precious', 'Proud', 'Real', 'Rich', 'Smily', 'Sleepy', 'Sore', 'Sparkling', 'Splendid',
                'Stormy', 'Strange', 'Super', 'Talented', 'Tense', 'Tender', 'Terrible', 'Thankful', 'Thoughtful',
                'Tired', 'Tough', 'Troubled', 'Unusual', 'Vast', 'Victorious', 'Vicious', 'Slick', 'Weary', 'Wicked',
                'Wild', 'Worried', 'Zealous', 'Orange', 'Yellow', 'Green', 'Blue', 'Pink', 'Purple', 'Indigo', 'Violet',
                'Affectionate', 'Stubborn', 'Confused', 'Sticky', 'Slimy', 'Hairless', 'Hairy']

    normal_nouns = ['Cheetah', 'Book', 'Chair', 'Pigeon', 'Dolphin', 'Actor', 'Animal', 'Apple', 'Balloon', 'Banana', 'Battery',
            'Bed', 'Boy', 'Branch', 'Car', 'Candle', 'Carpet', 'Crayon', 'Diamond', 'Dream', 'Dress', 'Egg', 'Eggplant',
            'Elephant', 'Eye', 'Fish', 'Forest', 'Football', 'Fountain', 'Garage', 'Gold', 'Grass', 'Guitar', 'Hamburger',
            'Helmet', 'Horse', 'Penguin', 'Honey', 'Ice', 'Insect', 'Iron', 'Jelly', 'Juice', 'Kangaroo', 'Kite', 'Knife',
            'Lamp', 'Lion', 'Lizard', 'Lunch', 'Magazine', 'Monkey', 'Microphone', 'Nail', 'Needle', 'Notebook', 'Ocean',
            'Oil', 'Oyster', 'Ghost', 'Parrot', 'Piano', 'Pizza', 'Pillow', 'Planet', 'Queen', 'Rainbow', 'Restaurant',
            'River', 'Rose', 'Sandwich', 'Shampoo', 'Sugar', 'Stone', 'Spoon', 'Shoe', 'Phone', 'Telephone', 'Television',
            'Tent', 'Tomato', 'Toothbrush', 'Train', 'Truck', 'Umbrella', 'Vase', 'Vegetable', 'Vulture', 'Wall', 'Whale',
            'Wizard', 'Window', 'Wire', 'Xylophone', 'Yacht', 'Zebra', 'Glass', 'Gas', 'Budgie', 'Snake', 'Chimpanzee']

    funny_adjectives = ['Hairy', 'Crazy', 'Hysterical', 'Funny', 'Feisty', 'Chunky', 'Fluffy', 'Hungry', 'Itchy', 'Jolly',
                        'Modern', 'Naughty', 'Obnoxious', 'Outrageous', 'Smily', 'Troubled', 'Wild', 'Brown', 'Hairless',
                        'Slimy', 'Sticky', 'Confused', 'Stubborn', 'Idiotic', 'Affectionate', 'Determined', 'Feeble'
                        'Flying', 'Helpless', 'Hopeful', 'Dead']

    funny_nouns = ['Monkey', 'Toaster', 'Lettuce', 'Kitty', 'ElasticBand', 'Arms', 'Legs', 'ToiletSeat', 'DeathWish',
                   'Pigeon', 'Egg', 'Grass', 'Hamburger', 'Shampoo', 'Door', 'Wall', 'FishEye', 'FluffBall', 'Sardine',
                   'Blubber', 'Gargoyle', 'Goggles', 'Hedge', 'Shrub', 'Squelch', 'Donkey', 'Pepper']

    animal_adjectives = ['Flying', 'Epic', 'Hissing', 'Swift', 'Fast', 'Amazing', 'Growling', 'Snarling', 'Frisky',
                         'Amphibious', 'Exotic', 'Feral', 'Wild', 'Dead', 'Scary', 'Fluffy', 'Domestic', 'Tame',
                         'Vicious', 'Graceful', 'Predatory', 'Aquatic', 'Screeching', 'Adorable']

    animal_nouns = ['Cat', 'Snake', 'Dog', 'Monkey', 'Budgie', 'Bird', 'Ant', 'Anteater', 'Fish', 'Sardine', 'Chimpanzee',
                    'Clownfish', 'Lionfish', 'Bear', 'Lion', 'Tiger', 'Elephant', 'Hippo', 'Rhinoceros', 'Frog', 'Wolf',
                    'Buffalo', 'Eagle', 'Hawk', 'Albatross', 'Lynx', 'PolarBear', 'Snowcat', 'Lizard', 'Crocodile',
                    'Alligator', 'Parrot', 'Badger', 'Beaver', 'Crow', 'Squirrel', 'Dragon', 'Cheetah', 'Pigeon',
                    'Dolphin', 'Kangaroo', 'Fly', 'Insect', 'Horse', 'Penguin', 'Squid', 'Octopus', 'Vulture',
                    'Zebra', 'Kitten', 'Donkey', 'Antelope', 'Echidna', 'Pelican', 'Baboon', 'Bee', 'Swan', 'Tapir',
                    'Hyena', 'Lemur', 'Pig', 'Cow', 'Sheep', 'Camel', 'Giraffe', 'Cobra', 'Crab', 'Crane', 'Dingo',
                    'Fox', 'Dove', 'JayBird', 'Owl', 'Hedgehog', 'Elk', 'Emu', 'Falcon', 'Turtle', 'Hornet', 'Wasp',
                    'Ibis', 'Jackal', 'Koala']

    landmarks_adjectives = ['Tall', 'Sparkling', 'Dazzling', 'White', 'Sandy', 'Rocky', 'Big', 'Large', 'Golden', 'Amazing',
                            'Inccredible']

    landmarks_nouns = ['EiffelTower', 'TowerOfPisa', 'Colosseum', 'WhiteHouse', 'TajMahal', 'WallOfChina', 'StatueOfLiberty',
                       'PyramidOfGiza', 'Uluru', 'OperaHouse', 'ParliamentHouse', 'LondonEye', 'Stonehenge',
                       'GoldenGateBridge']

    food_adjectives = ['Delicious', 'Juicy', 'Luxurious', 'Warm', 'Salty', 'Spicy', 'Flavoursome', 'Bitter', 'Enjoyable',
                       'Delectable', 'Crunchy', 'Sweet', 'Sour', 'Savoury', 'Divine', 'Fruity', 'Appetising', 'Heavenly',
                       'Hot', 'Lush', 'Mouthwatering', 'Incredible', 'Horrid', 'Peppery', 'Pungent', 'Pleasant',
                       'Rich', 'Scrumptious', 'Sharp', 'Strong', 'Succulent', 'Sugary', 'Saline', 'Tasteless', 'Tasty',
                       'Yummy']

    food_nouns = ['Apple', 'Banana', 'Hamburger', 'Burger', 'Cheeseburger', 'Strawberry', 'Steak', 'Pasta', 'Mince',
                  'Fry', 'Chip', 'Avocado', 'Blueberry', 'Orange', 'Egg', 'Chicken', 'Coconut', 'Asparagus', 'Broccoli',
                  'Cauliflower', 'Carrot', 'Cucumber', 'Garlic', 'Kale', 'Tomato', 'Salmon', 'Cereal', 'Fruit',
                  'Bread', 'Cookie', 'Cheese', 'Yoghurt', 'Milk', 'Juice', 'Eggplant', 'Jelly', 'Honey', 'Pizza']

    harrypotter_adjectives = ['Magical', 'Swish', 'Flick', 'Transforming', 'Brave', 'Bold', 'Invisible', 'Dead', 'Forbidden',
                              'Mysterious', 'Secret']

    harrypotter_nouns = ['HarryPotter', 'Dumbledore', 'Snape', 'Weasley', 'Hermione', 'McGonagall', 'SiriusBlack',
                         'Hagrid', 'Hedwig', 'Dobby', 'Voldemort', 'Mad-EyeMoody', 'Malfoy', 'Lovegood', 'Longbottom',
                         'DeathlyHallows', 'Umbridge', 'Lupin', 'Scamander', 'Nagini', 'Lestrange', 'Dursley', 'Tonks',
                         'Transfiguration', 'Gryffindor', 'Ravenclaw', 'Slytherin', 'Hufflepuff', 'Hogwarts', 'Magic']

    cats_adjectives = ['Fuzzy', 'Furry', 'Agile', 'Clever', 'Precise', 'Patient', 'Hunter', 'Loud', 'Lethal', 'Lazy',
                       'Predatory', 'Energetic', 'Sleepy', 'Loyal', 'Adorable', 'Cute', 'Passionate']

    cats_nouns = ['Feline', 'Cat', 'Meow', 'Purr', 'Hiss', 'Persian', 'Bengal', 'MaineCoon', 'Siamese', 'Sphynx', 'Ragdoll',
                  'Abyssinian']

    dogs_adjectives = ['Friendly', 'Loyal', 'Loud', 'Adorable', 'Cute', 'Passionate', 'Strong', 'Smelly', 'Protective',
                       'Smart', 'Obedient']

    dogs_nouns = ['Woof', 'Dog', 'GermanShepherd', 'Labrador', 'Retriever', 'Husky', 'Poodle', 'Bulldog', 'Pug', 'Chihuahua',
                  'Rottweiler', 'Maltese', 'Terrier', 'ChowChow']

    numbers = random.randint(1,100)

    symbols = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '\'', '-', '_', '+', '=', '`', '~', '[', '{', ']', '}', '|',
             '<', '.', '>', '/', '?']

    result_normal = random.choice(normal_adjectives) + random.choice(normal_nouns)
    result_funny = random.choice(funny_adjectives) + random.choice(funny_nouns)
    result_animal = random.choice(animal_adjectives) + random.choice(animal_nouns)
    result_landmarks = random.choice(landmarks_adjectives) + random.choice(landmarks_nouns)
    result_food = random.choice(food_adjectives) + random.choice(food_nouns)
    result_potter = random.choice(harrypotter_adjectives) + random.choice(harrypotter_nouns)
    result_cats = random.choice(cats_adjectives) + random.choice(cats_nouns)
    result_dogs = random.choice(dogs_adjectives) + random.choice(dogs_nouns)

    case = input('Would you like your password in lowercase, uppercase or normal? (lower, upper, normal) ')
    number_want = input('Do you want numbers? y/n ')
    symbol_want = input('Do you want symbols? y/n ')
    theme = input('Enter in the theme for your password (normal/funny/animal/landmarks/food/harry potter/cats/dogs) ')

    if case == 'upper':
        result_normal = result_normal.upper()
        result_funny = result_funny.upper()
        result_animal = result_animal.upper()
        result_landmarks = result_landmarks.upper()
        result_food = result_food.upper()
        result_potter = result_potter.upper()
        result_cats = result_cats.upper()
        result_dogs = result_dogs.upper()

    if case == 'lower':
        result_normal = result_normal.lower()
        result_funny = result_funny.lower()
        result_animal = result_animal.lower()
        result_landmarks = result_landmarks.lower()
        result_food = result_food.lower()
        result_potter = result_potter.lower()
        result_cats = result_cats.lower()
        result_dogs = result_dogs.lower()

    if number_want == 'y':
        result_normal = result_normal + str(numbers)
        result_funny = result_funny + str(numbers)
        result_animal = result_animal + str(numbers)
        result_landmarks = result_landmarks + str(numbers)
        result_food = result_food + str(numbers)
        result_potter = result_potter + str(numbers)
        result_cats = result_cats + str(numbers)
        result_dogs = result_dogs + str(numbers)

    if symbol_want == 'y':
        result_normal = result_normal + random.choice(symbols)
        result_funny = result_funny + random.choice(symbols)
        result_animal = result_animal + random.choice(symbols)
        result_landmarks = result_landmarks + random.choice(symbols)
        result_food = result_food + random.choice(symbols)
        result_potter = result_potter + random.choice(symbols)
        result_cats = result_cats + random.choice(symbols)
        result_dogs = result_dogs + random.choice(symbols)

        if theme=='normal':
            print(result_normal)
            print('Your new password is ' + result_normal)
        elif theme=='funny':
            print(result_funny)
            print('Your new password is ' + result_funny)
        elif theme=='animal':
            print(result_animal)
            print('Your new password is ' + result_animal)
        elif theme=='landmarks':
            print(result_landmarks)
            print('Your new password is ' + result_landmarks)
        elif theme=='food':
            print(result_food)
            print('Your new password is ' + result_food)
        elif theme=='harry potter':
            print(result_potter)
            print('Your new password is ' + result_potter)
        elif theme=='cats':
            print(result_cats)
            print('Your new password is ' + result_cats)
        elif theme=='dogs':
            print(result_dogs)
            print('Your new password is ' + result_dogs)
        else:
            print(theme + ' is not a valid theme!')

    other_p = input('Would you like another password? y/n ')

    if other_p == 'y':
        password()

start = input('Welcome to the Python Password Generator! Type the word start to start! ')

if start == 'start':
    password()
else:
   print('Type \'start\' to start, not ' + start)
</code>```

答:
This is an indentation error. The if statements that print the password at the end are inside the symbol_want if statement. You need to unindent the print statements by one level, and it will work fine.

```<code>import random

def password():
    normal_adjectives = ['Funny', 'Amazing', 'Infinity', 'Fabulous', 'Red', 'Rainbow', 'Adorable', 'Adventurous', 'Impressive', 'Determined',
                  'Delighted', 'Scary', 'Active', 'Distinct', 'Eager', 'Elegant', 'Excited', 'Enchanted', 'Fair', 'Fierce', 'Fancy',
                  'Gentle', 'Glamorous', 'Graceful', 'Happy', 'Handsome', 'Hungry', 'Fluffy', 'Important', 'Itchy', 'Impossible',
                  'Jealous', 'Joyous', 'Jolly', 'Kind', 'Caring', 'Lazy', 'Lonely', 'Lucky', 'Lovely', 'Magnificent', 'Modern',
                'Mysterious', 'Naughty', 'Nervous', 'Nice', 'Obnoxious', 'Outrageous', 'Outstanding', 'Perfect', 'Pleasant',
                'Powerful', 'Precious', 'Proud', 'Real', 'Rich', 'Smily', 'Sleepy', 'Sore', 'Sparkling', 'Splendid',
                'Stormy', 'Strange', 'Super', 'Talented', 'Tense', 'Tender', 'Terrible', 'Thankful', 'Thoughtful',
                'Tired', 'Tough', 'Troubled', 'Unusual', 'Vast', 'Victorious', 'Vicious', 'Slick', 'Weary', 'Wicked',
                'Wild', 'Worried', 'Zealous', 'Orange', 'Yellow', 'Green', 'Blue', 'Pink', 'Purple', 'Indigo', 'Violet',
                'Affectionate', 'Stubborn', 'Confused', 'Sticky', 'Slimy', 'Hairless', 'Hairy']

    normal_nouns = ['Cheetah', 'Book', 'Chair', 'Pigeon', 'Dolphin', 'Actor', 'Animal', 'Apple', 'Balloon', 'Banana', 'Battery',
            'Bed', 'Boy', 'Branch', 'Car', 'Candle', 'Carpet', 'Crayon', 'Diamond', 'Dream', 'Dress', 'Egg', 'Eggplant',
            'Elephant', 'Eye', 'Fish', 'Forest', 'Football', 'Fountain', 'Garage', 'Gold', 'Grass', 'Guitar', 'Hamburger',
            'Helmet', 'Horse', 'Penguin', 'Honey', 'Ice', 'Insect', 'Iron', 'Jelly', 'Juice', 'Kangaroo', 'Kite', 'Knife',
            'Lamp', 'Lion', 'Lizard', 'Lunch', 'Magazine', 'Monkey', 'Microphone', 'Nail', 'Needle', 'Notebook', 'Ocean',
            'Oil', 'Oyster', 'Ghost', 'Parrot', 'Piano', 'Pizza', 'Pillow', 'Planet', 'Queen', 'Rainbow', 'Restaurant',
            'River', 'Rose', 'Sandwich', 'Shampoo', 'Sugar', 'Stone', 'Spoon', 'Shoe', 'Phone', 'Telephone', 'Television',
            'Tent', 'Tomato', 'Toothbrush', 'Train', 'Truck', 'Umbrella', 'Vase', 'Vegetable', 'Vulture', 'Wall', 'Whale',
            'Wizard', 'Window', 'Wire', 'Xylophone', 'Yacht', 'Zebra', 'Glass', 'Gas', 'Budgie', 'Snake', 'Chimpanzee']

    funny_adjectives = ['Hairy', 'Crazy', 'Hysterical', 'Funny', 'Feisty', 'Chunky', 'Fluffy', 'Hungry', 'Itchy', 'Jolly',
                        'Modern', 'Naughty', 'Obnoxious', 'Outrageous', 'Smily', 'Troubled', 'Wild', 'Brown', 'Hairless',
                        'Slimy', 'Sticky', 'Confused', 'Stubborn', 'Idiotic', 'Affectionate', 'Determined', 'Feeble'
                        'Flying', 'Helpless', 'Hopeful', 'Dead']

    funny_nouns = ['Monkey', 'Toaster', 'Lettuce', 'Kitty', 'ElasticBand', 'Arms', 'Legs', 'ToiletSeat', 'DeathWish',
                   'Pigeon', 'Egg', 'Grass', 'Hamburger', 'Shampoo', 'Door', 'Wall', 'FishEye', 'FluffBall', 'Sardine',
                   'Blubber', 'Gargoyle', 'Goggles', 'Hedge', 'Shrub', 'Squelch', 'Donkey', 'Pepper']

    animal_adjectives = ['Flying', 'Epic', 'Hissing', 'Swift', 'Fast', 'Amazing', 'Growling', 'Snarling', 'Frisky',
                         'Amphibious', 'Exotic', 'Feral', 'Wild', 'Dead', 'Scary', 'Fluffy', 'Domestic', 'Tame',
                         'Vicious', 'Graceful', 'Predatory', 'Aquatic', 'Screeching', 'Adorable']

    animal_nouns = ['Cat', 'Snake', 'Dog', 'Monkey', 'Budgie', 'Bird', 'Ant', 'Anteater', 'Fish', 'Sardine', 'Chimpanzee',
                    'Clownfish', 'Lionfish', 'Bear', 'Lion', 'Tiger', 'Elephant', 'Hippo', 'Rhinoceros', 'Frog', 'Wolf',
                    'Buffalo', 'Eagle', 'Hawk', 'Albatross', 'Lynx', 'PolarBear', 'Snowcat', 'Lizard', 'Crocodile',
                    'Alligator', 'Parrot', 'Badger', 'Beaver', 'Crow', 'Squirrel', 'Dragon', 'Cheetah', 'Pigeon',
                    'Dolphin', 'Kangaroo', 'Fly', 'Insect', 'Horse', 'Penguin', 'Squid', 'Octopus', 'Vulture',
                    'Zebra', 'Kitten', 'Donkey', 'Antelope', 'Echidna', 'Pelican', 'Baboon', 'Bee', 'Swan', 'Tapir',
                    'Hyena', 'Lemur', 'Pig', 'Cow', 'Sheep', 'Camel', 'Giraffe', 'Cobra', 'Crab', 'Crane', 'Dingo',
                    'Fox', 'Dove', 'JayBird', 'Owl', 'Hedgehog', 'Elk', 'Emu', 'Falcon', 'Turtle', 'Hornet', 'Wasp',
                    'Ibis', 'Jackal', 'Koala']

    landmarks_adjectives = ['Tall', 'Sparkling', 'Dazzling', 'White', 'Sandy', 'Rocky', 'Big', 'Large', 'Golden', 'Amazing',
                            'Inccredible']

    landmarks_nouns = ['EiffelTower', 'TowerOfPisa', 'Colosseum', 'WhiteHouse', 'TajMahal', 'WallOfChina', 'StatueOfLiberty',
                       'PyramidOfGiza', 'Uluru', 'OperaHouse', 'ParliamentHouse', 'LondonEye', 'Stonehenge',
                       'GoldenGateBridge']

    food_adjectives = ['Delicious', 'Juicy', 'Luxurious', 'Warm', 'Salty', 'Spicy', 'Flavoursome', 'Bitter', 'Enjoyable',
                       'Delectable', 'Crunchy', 'Sweet', 'Sour', 'Savoury', 'Divine', 'Fruity', 'Appetising', 'Heavenly',
                       'Hot', 'Lush', 'Mouthwatering', 'Incredible', 'Horrid', 'Peppery', 'Pungent', 'Pleasant',
                       'Rich', 'Scrumptious', 'Sharp', 'Strong', 'Succulent', 'Sugary', 'Saline', 'Tasteless', 'Tasty',
                       'Yummy']

    food_nouns = ['Apple', 'Banana', 'Hamburger', 'Burger', 'Cheeseburger', 'Strawberry', 'Steak', 'Pasta', 'Mince',
                  'Fry', 'Chip', 'Avocado', 'Blueberry', 'Orange', 'Egg', 'Chicken', 'Coconut', 'Asparagus', 'Broccoli',
                  'Cauliflower', 'Carrot', 'Cucumber', 'Garlic', 'Kale', 'Tomato', 'Salmon', 'Cereal', 'Fruit',
                  'Bread', 'Cookie', 'Cheese', 'Yoghurt', 'Milk', 'Juice', 'Eggplant', 'Jelly', 'Honey', 'Pizza']

    harrypotter_adjectives = ['Magical', 'Swish', 'Flick', 'Transforming', 'Brave', 'Bold', 'Invisible', 'Dead', 'Forbidden',
                              'Mysterious', 'Secret']

    harrypotter_nouns = ['HarryPotter', 'Dumbledore', 'Snape', 'Weasley', 'Hermione', 'McGonagall', 'SiriusBlack',
                         'Hagrid', 'Hedwig', 'Dobby', 'Voldemort', 'Mad-EyeMoody', 'Malfoy', 'Lovegood', 'Longbottom',
                         'DeathlyHallows', 'Umbridge', 'Lupin', 'Scamander', 'Nagini', 'Lestrange', 'Dursley', 'Tonks',
                         'Transfiguration', 'Gryffindor', 'Ravenclaw', 'Slytherin', 'Hufflepuff', 'Hogwarts', 'Magic']

    cats_adjectives = ['Fuzzy', 'Furry', 'Agile', 'Clever', 'Precise', 'Patient', 'Hunter', 'Loud', 'Lethal', 'Lazy',
                       'Predatory', 'Energetic', 'Sleepy', 'Loyal', 'Adorable', 'Cute', 'Passionate']

    cats_nouns = ['Feline', 'Cat', 'Meow', 'Purr', 'Hiss', 'Persian', 'Bengal', 'MaineCoon', 'Siamese', 'Sphynx', 'Ragdoll',
                  'Abyssinian']

    dogs_adjectives = ['Friendly', 'Loyal', 'Loud', 'Adorable', 'Cute', 'Passionate', 'Strong', 'Smelly', 'Protective',
                       'Smart', 'Obedient']

    dogs_nouns = ['Woof', 'Dog', 'GermanShepherd', 'Labrador', 'Retriever', 'Husky', 'Poodle', 'Bulldog', 'Pug', 'Chihuahua',
                  'Rottweiler', 'Maltese', 'Terrier', 'ChowChow']

    numbers = random.randint(1,100)

    symbols = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '\'', '-', '_', '+', '=', '`', '~', '[', '{', ']', '}', '|',
             '<', '.', '>', '/', '?']

    result_normal = random.choice(normal_adjectives) + random.choice(normal_nouns)
    result_funny = random.choice(funny_adjectives) + random.choice(funny_nouns)
    result_animal = random.choice(animal_adjectives) + random.choice(animal_nouns)
    result_landmarks = random.choice(landmarks_adjectives) + random.choice(landmarks_nouns)
    result_food = random.choice(food_adjectives) + random.choice(food_nouns)
    result_potter = random.choice(harrypotter_adjectives) + random.choice(harrypotter_nouns)
    result_cats = random.choice(cats_adjectives) + random.choice(cats_nouns)
    result_dogs = random.choice(dogs_adjectives) + random.choice(dogs_nouns)

    case = input('Would you like your password in lowercase, uppercase or normal? (lower, upper, normal) ')
    number_want = input('Do you want numbers? y/n ')
    symbol_want = input('Do you want symbols? y/n ')
    theme = input('Enter in the theme for your password (normal/funny/animal/landmarks/food/harry potter/cats/dogs) ')

    if case == 'upper':
        result_normal = result_normal.upper()
        result_funny = result_funny.upper()
        result_animal = result_animal.upper()
        result_landmarks = result_landmarks.upper()
        result_food = result_food.upper()
        result_potter = result_potter.upper()
        result_cats = result_cats.upper()
        result_dogs = result_dogs.upper()

    if case == 'lower':
        result_normal = result_normal.lower()
        result_funny = result_funny.lower()
        result_animal = result_animal.lower()
        result_landmarks = result_landmarks.lower()
        result_food = result_food.lower()
        result_potter = result_potter.lower()
        result_cats = result_cats.lower()
        result_dogs = result_dogs.lower()

    if number_want == 'y':
        result_normal = result_normal + str(numbers)
        result_funny = result_funny + str(numbers)
        result_animal = result_animal + str(numbers)
        result_landmarks = result_landmarks + str(numbers)
        result_food = result_food + str(numbers)
        result_potter = result_potter + str(numbers)
        result_cats = result_cats + str(numbers)
        result_dogs = result_dogs + str(numbers)

    if symbol_want == 'y':
        result_normal = result_normal + random.choice(symbols)
        result_funny = result_funny + random.choice(symbols)
        result_animal = result_animal + random.choice(symbols)
        result_landmarks = result_landmarks + random.choice(symbols)
        result_food = result_food + random.choice(symbols)
        result_potter = result_potter + random.choice(symbols)
        result_cats = result_cats + random.choice(symbols)
        result_dogs = result_dogs + random.choice(symbols)

    if theme=='normal':
        print(result_normal)
        print('Your new password is ' + result_normal)
    elif theme=='funny':
        print(result_funny)
        print('Your new password is ' + result_funny)
    elif theme=='animal':
        print(result_animal)
        print('Your new password is ' + result_animal)
    elif theme=='landmarks':
        print(result_landmarks)
        print('Your new password is ' + result_landmarks)
    elif theme=='food':
        print(result_food)
        print('Your new password is ' + result_food)
    elif theme=='harry potter':
        print(result_potter)
        print('Your new password is ' + result_potter)
    elif theme=='cats':
        print(result_cats)
        print('Your new password is ' + result_cats)
    elif theme=='dogs':
        print(result_dogs)
        print('Your new password is ' + result_dogs)
    else:
        print(theme + ' is not a valid theme!')

    other_p = input('Would you like another password? y/n ')

    if other_p == 'y':
        password()

start = input('Welcome to the Python Password Generator! Type the word start to start! ')

if start == 'start':
    password()
else:
   print('Type \'start\' to start, not ' + start)
</code>```

While this will work once you fix the indentation, this is a terrible implementation. I would suggest setting the theme first, and then adding numbers and symbols. Something like

```<code>case = input('Would you like your password in lowercase, uppercase or normal? (lower, upper, normal) ')
number_want = input('Do you want numbers? y/n ')
symbol_want = input('Do you want symbols? y/n ')
theme = input('Enter in the theme for your password (normal/funny/animal/landmarks/food/harry potter/cats/dogs) ')

if theme == 'normal':
    password = random.choice(normal_adjectives) + random.choice(normal_nouns)
elif theme == 'funny':
    password = random.choice(funny_adjectives) + random.choice(funny_nouns)
elif theme == 'animal':
    password = random.choice(animal_adjectives) + random.choice(animal_nouns)
elif theme == 'landmarks':
    password = random.choice(landmarks_adjectives) + random.choice(landmarks_nouns)
elif theme == 'food':
    password = random.choice(food_adjectives) + random.choice(food_nouns)
elif theme == 'harry potter':
    password = random.choice(harrypotter_adjectives) + random.choice(harrypotter_nouns)
elif theme == 'cats':
    password = random.choice(cats_adjectives) + random.choice(cats_nouns)
elif theme == 'dogs':
   password = random.choice(dogs_adjectives) + random.choice(dogs_nouns)
else:
    print(theme + ' is not a valid theme!')

if case == 'upper':
    password = password.upper()

if case == 'lower':
    password = password.lower()

if number_want == 'y':
    password = password + str(numbers)

if symbol_want == 'y':
    password = password + random.choice(symbols)

print("Your password is:", password)

other_p = input('Would you like another password? y/n ')

if other_p == 'y':
    password()
</code>```

Body:
What is wrong with my code? I started python a few weeks ago, and I am trying to make a random password generator that is customisable. I want to give the user options to have it fully capitalised, fully lowercase or normal (each different word capitalised at the start). I also want them to have the option to have numbers or symbols or not. Every time I run the program, it does not let me have numbers with no symbols. What is wrong?

to the people who just replied saying to show the error and stuff, I literally just signed up for stack overflow and it says that I cant upload pictures yet how can I do that

import random

def password():
    normal_adjectives = ['Funny', 'Amazing', 'Infinity', 'Fabulous', 'Red', 'Rainbow', 'Adorable', 'Adventurous', 'Impressive', 'Determined',
                  'Delighted', 'Scary', 'Active', 'Distinct', 'Eager', 'Elegant', 'Excited', 'Enchanted', 'Fair', 'Fierce', 'Fancy',
                  'Gentle', 'Glamorous', 'Graceful', 'Happy', 'Handsome', 'Hungry', 'Fluffy', 'Important', 'Itchy', 'Impossible',
                  'Jealous', 'Joyous', 'Jolly', 'Kind', 'Caring', 'Lazy', 'Lonely', 'Lucky', 'Lovely', 'Magnificent', 'Modern',
                'Mysterious', 'Naughty', 'Nervous', 'Nice', 'Obnoxious', 'Outrageous', 'Outstanding', 'Perfect', 'Pleasant',
                'Powerful', 'Precious', 'Proud', 'Real', 'Rich', 'Smily', 'Sleepy', 'Sore', 'Sparkling', 'Splendid',
                'Stormy', 'Strange', 'Super', 'Talented', 'Tense', 'Tender', 'Terrible', 'Thankful', 'Thoughtful',
                'Tired', 'Tough', 'Troubled', 'Unusual', 'Vast', 'Victorious', 'Vicious', 'Slick', 'Weary', 'Wicked',
                'Wild', 'Worried', 'Zealous', 'Orange', 'Yellow', 'Green', 'Blue', 'Pink', 'Purple', 'Indigo', 'Violet',
                'Affectionate', 'Stubborn', 'Confused', 'Sticky', 'Slimy', 'Hairless', 'Hairy']

    normal_nouns = ['Cheetah', 'Book', 'Chair', 'Pigeon', 'Dolphin', 'Actor', 'Animal', 'Apple', 'Balloon', 'Banana', 'Battery',
            'Bed', 'Boy', 'Branch', 'Car', 'Candle', 'Carpet', 'Crayon', 'Diamond', 'Dream', 'Dress', 'Egg', 'Eggplant',
            'Elephant', 'Eye', 'Fish', 'Forest', 'Football', 'Fountain', 'Garage', 'Gold', 'Grass', 'Guitar', 'Hamburger',
            'Helmet', 'Horse', 'Penguin', 'Honey', 'Ice', 'Insect', 'Iron', 'Jelly', 'Juice', 'Kangaroo', 'Kite', 'Knife',
            'Lamp', 'Lion', 'Lizard', 'Lunch', 'Magazine', 'Monkey', 'Microphone', 'Nail', 'Needle', 'Notebook', 'Ocean',
            'Oil', 'Oyster', 'Ghost', 'Parrot', 'Piano', 'Pizza', 'Pillow', 'Planet', 'Queen', 'Rainbow', 'Restaurant',
            'River', 'Rose', 'Sandwich', 'Shampoo', 'Sugar', 'Stone', 'Spoon', 'Shoe', 'Phone', 'Telephone', 'Television',
            'Tent', 'Tomato', 'Toothbrush', 'Train', 'Truck', 'Umbrella', 'Vase', 'Vegetable', 'Vulture', 'Wall', 'Whale',
            'Wizard', 'Window', 'Wire', 'Xylophone', 'Yacht', 'Zebra', 'Glass', 'Gas', 'Budgie', 'Snake', 'Chimpanzee']

    funny_adjectives = ['Hairy', 'Crazy', 'Hysterical', 'Funny', 'Feisty', 'Chunky', 'Fluffy', 'Hungry', 'Itchy', 'Jolly',
                        'Modern', 'Naughty', 'Obnoxious', 'Outrageous', 'Smily', 'Troubled', 'Wild', 'Brown', 'Hairless',
                        'Slimy', 'Sticky', 'Confused', 'Stubborn', 'Idiotic', 'Affectionate', 'Determined', 'Feeble'
                        'Flying', 'Helpless', 'Hopeful', 'Dead']

    funny_nouns = ['Monkey', 'Toaster', 'Lettuce', 'Kitty', 'ElasticBand', 'Arms', 'Legs', 'ToiletSeat', 'DeathWish',
                   'Pigeon', 'Egg', 'Grass', 'Hamburger', 'Shampoo', 'Door', 'Wall', 'FishEye', 'FluffBall', 'Sardine',
                   'Blubber', 'Gargoyle', 'Goggles', 'Hedge', 'Shrub', 'Squelch', 'Donkey', 'Pepper']

    animal_adjectives = ['Flying', 'Epic', 'Hissing', 'Swift', 'Fast', 'Amazing', 'Growling', 'Snarling', 'Frisky',
                         'Amphibious', 'Exotic', 'Feral', 'Wild', 'Dead', 'Scary', 'Fluffy', 'Domestic', 'Tame',
                         'Vicious', 'Graceful', 'Predatory', 'Aquatic', 'Screeching', 'Adorable']

    animal_nouns = ['Cat', 'Snake', 'Dog', 'Monkey', 'Budgie', 'Bird', 'Ant', 'Anteater', 'Fish', 'Sardine', 'Chimpanzee',
                    'Clownfish', 'Lionfish', 'Bear', 'Lion', 'Tiger', 'Elephant', 'Hippo', 'Rhinoceros', 'Frog', 'Wolf',
                    'Buffalo', 'Eagle', 'Hawk', 'Albatross', 'Lynx', 'PolarBear', 'Snowcat', 'Lizard', 'Crocodile',
                    'Alligator', 'Parrot', 'Badger', 'Beaver', 'Crow', 'Squirrel', 'Dragon', 'Cheetah', 'Pigeon',
                    'Dolphin', 'Kangaroo', 'Fly', 'Insect', 'Horse', 'Penguin', 'Squid', 'Octopus', 'Vulture',
                    'Zebra', 'Kitten', 'Donkey', 'Antelope', 'Echidna', 'Pelican', 'Baboon', 'Bee', 'Swan', 'Tapir',
                    'Hyena', 'Lemur', 'Pig', 'Cow', 'Sheep', 'Camel', 'Giraffe', 'Cobra', 'Crab', 'Crane', 'Dingo',
                    'Fox', 'Dove', 'JayBird', 'Owl', 'Hedgehog', 'Elk', 'Emu', 'Falcon', 'Turtle', 'Hornet', 'Wasp',
                    'Ibis', 'Jackal', 'Koala']

    landmarks_adjectives = ['Tall', 'Sparkling', 'Dazzling', 'White', 'Sandy', 'Rocky', 'Big', 'Large', 'Golden', 'Amazing',
                            'Inccredible']

    landmarks_nouns = ['EiffelTower', 'TowerOfPisa', 'Colosseum', 'WhiteHouse', 'TajMahal', 'WallOfChina', 'StatueOfLiberty',
                       'PyramidOfGiza', 'Uluru', 'OperaHouse', 'ParliamentHouse', 'LondonEye', 'Stonehenge',
                       'GoldenGateBridge']

    food_adjectives = ['Delicious', 'Juicy', 'Luxurious', 'Warm', 'Salty', 'Spicy', 'Flavoursome', 'Bitter', 'Enjoyable',
                       'Delectable', 'Crunchy', 'Sweet', 'Sour', 'Savoury', 'Divine', 'Fruity', 'Appetising', 'Heavenly',
                       'Hot', 'Lush', 'Mouthwatering', 'Incredible', 'Horrid', 'Peppery', 'Pungent', 'Pleasant',
                       'Rich', 'Scrumptious', 'Sharp', 'Strong', 'Succulent', 'Sugary', 'Saline', 'Tasteless', 'Tasty',
                       'Yummy']

    food_nouns = ['Apple', 'Banana', 'Hamburger', 'Burger', 'Cheeseburger', 'Strawberry', 'Steak', 'Pasta', 'Mince',
                  'Fry', 'Chip', 'Avocado', 'Blueberry', 'Orange', 'Egg', 'Chicken', 'Coconut', 'Asparagus', 'Broccoli',
                  'Cauliflower', 'Carrot', 'Cucumber', 'Garlic', 'Kale', 'Tomato', 'Salmon', 'Cereal', 'Fruit',
                  'Bread', 'Cookie', 'Cheese', 'Yoghurt', 'Milk', 'Juice', 'Eggplant', 'Jelly', 'Honey', 'Pizza']

    harrypotter_adjectives = ['Magical', 'Swish', 'Flick', 'Transforming', 'Brave', 'Bold', 'Invisible', 'Dead', 'Forbidden',
                              'Mysterious', 'Secret']

    harrypotter_nouns = ['HarryPotter', 'Dumbledore', 'Snape', 'Weasley', 'Hermione', 'McGonagall', 'SiriusBlack',
                         'Hagrid', 'Hedwig', 'Dobby', 'Voldemort', 'Mad-EyeMoody', 'Malfoy', 'Lovegood', 'Longbottom',
                         'DeathlyHallows', 'Umbridge', 'Lupin', 'Scamander', 'Nagini', 'Lestrange', 'Dursley', 'Tonks',
                         'Transfiguration', 'Gryffindor', 'Ravenclaw', 'Slytherin', 'Hufflepuff', 'Hogwarts', 'Magic']

    cats_adjectives = ['Fuzzy', 'Furry', 'Agile', 'Clever', 'Precise', 'Patient', 'Hunter', 'Loud', 'Lethal', 'Lazy',
                       'Predatory', 'Energetic', 'Sleepy', 'Loyal', 'Adorable', 'Cute', 'Passionate']

    cats_nouns = ['Feline', 'Cat', 'Meow', 'Purr', 'Hiss', 'Persian', 'Bengal', 'MaineCoon', 'Siamese', 'Sphynx', 'Ragdoll',
                  'Abyssinian']

    dogs_adjectives = ['Friendly', 'Loyal', 'Loud', 'Adorable', 'Cute', 'Passionate', 'Strong', 'Smelly', 'Protective',
                       'Smart', 'Obedient']

    dogs_nouns = ['Woof', 'Dog', 'GermanShepherd', 'Labrador', 'Retriever', 'Husky', 'Poodle', 'Bulldog', 'Pug', 'Chihuahua',
                  'Rottweiler', 'Maltese', 'Terrier', 'ChowChow']

    numbers = random.randint(1,100)

    symbols = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '\'', '-', '_', '+', '=', '`', '~', '[', '{', ']', '}', '|',
             '<', '.', '>', '/', '?']

    result_normal = random.choice(normal_adjectives) + random.choice(normal_nouns)
    result_funny = random.choice(funny_adjectives) + random.choice(funny_nouns)
    result_animal = random.choice(animal_adjectives) + random.choice(animal_nouns)
    result_landmarks = random.choice(landmarks_adjectives) + random.choice(landmarks_nouns)
    result_food = random.choice(food_adjectives) + random.choice(food_nouns)
    result_potter = random.choice(harrypotter_adjectives) + random.choice(harrypotter_nouns)
    result_cats = random.choice(cats_adjectives) + random.choice(cats_nouns)
    result_dogs = random.choice(dogs_adjectives) + random.choice(dogs_nouns)

    case = input('Would you like your password in lowercase, uppercase or normal? (lower, upper, normal) ')
    number_want = input('Do you want numbers? y/n ')
    symbol_want = input('Do you want symbols? y/n ')
    theme = input('Enter in the theme for your password (normal/funny/animal/landmarks/food/harry potter/cats/dogs) ')

    if case == 'upper':
        result_normal = result_normal.upper()
        result_funny = result_funny.upper()
        result_animal = result_animal.upper()
        result_landmarks = result_landmarks.upper()
        result_food = result_food.upper()
        result_potter = result_potter.upper()
        result_cats = result_cats.upper()
        result_dogs = result_dogs.upper()

    if case == 'lower':
        result_normal = result_normal.lower()
        result_funny = result_funny.lower()
        result_animal = result_animal.lower()
        result_landmarks = result_landmarks.lower()
        result_food = result_food.lower()
        result_potter = result_potter.lower()
        result_cats = result_cats.lower()
        result_dogs = result_dogs.lower()

    if number_want == 'y':
        result_normal = result_normal + str(numbers)
        result_funny = result_funny + str(numbers)
        result_animal = result_animal + str(numbers)
        result_landmarks = result_landmarks + str(numbers)
        result_food = result_food + str(numbers)
        result_potter = result_potter + str(numbers)
        result_cats = result_cats + str(numbers)
        result_dogs = result_dogs + str(numbers)

    if symbol_want == 'y':
        result_normal = result_normal + random.choice(symbols)
        result_funny = result_funny + random.choice(symbols)
        result_animal = result_animal + random.choice(symbols)
        result_landmarks = result_landmarks + random.choice(symbols)
        result_food = result_food + random.choice(symbols)
        result_potter = result_potter + random.choice(symbols)
        result_cats = result_cats + random.choice(symbols)
        result_dogs = result_dogs + random.choice(symbols)

        if theme=='normal':
            print(result_normal)
            print('Your new password is ' + result_normal)
        elif theme=='funny':
            print(result_funny)
            print('Your new password is ' + result_funny)
        elif theme=='animal':
            print(result_animal)
            print('Your new password is ' + result_animal)
        elif theme=='landmarks':
            print(result_landmarks)
            print('Your new password is ' + result_landmarks)
        elif theme=='food':
            print(result_food)
            print('Your new password is ' + result_food)
        elif theme=='harry potter':
            print(result_potter)
            print('Your new password is ' + result_potter)
        elif theme=='cats':
            print(result_cats)
            print('Your new password is ' + result_cats)
        elif theme=='dogs':
            print(result_dogs)
            print('Your new password is ' + result_dogs)
        else:
            print(theme + ' is not a valid theme!')

    other_p = input('Would you like another password? y/n ')

    if other_p == 'y':
        password()

start = input('Welcome to the Python Password Generator! Type the word start to start! ')

if start == 'start':
    password()
else:
   print('Type \'start\' to start, not ' + start)

Body:
This is an indentation error. The if statements that print the password at the end are inside the symbol_want if statement. You need to unindent the print statements by one level, and it will work fine.

import random

def password():
    normal_adjectives = ['Funny', 'Amazing', 'Infinity', 'Fabulous', 'Red', 'Rainbow', 'Adorable', 'Adventurous', 'Impressive', 'Determined',
                  'Delighted', 'Scary', 'Active', 'Distinct', 'Eager', 'Elegant', 'Excited', 'Enchanted', 'Fair', 'Fierce', 'Fancy',
                  'Gentle', 'Glamorous', 'Graceful', 'Happy', 'Handsome', 'Hungry', 'Fluffy', 'Important', 'Itchy', 'Impossible',
                  'Jealous', 'Joyous', 'Jolly', 'Kind', 'Caring', 'Lazy', 'Lonely', 'Lucky', 'Lovely', 'Magnificent', 'Modern',
                'Mysterious', 'Naughty', 'Nervous', 'Nice', 'Obnoxious', 'Outrageous', 'Outstanding', 'Perfect', 'Pleasant',
                'Powerful', 'Precious', 'Proud', 'Real', 'Rich', 'Smily', 'Sleepy', 'Sore', 'Sparkling', 'Splendid',
                'Stormy', 'Strange', 'Super', 'Talented', 'Tense', 'Tender', 'Terrible', 'Thankful', 'Thoughtful',
                'Tired', 'Tough', 'Troubled', 'Unusual', 'Vast', 'Victorious', 'Vicious', 'Slick', 'Weary', 'Wicked',
                'Wild', 'Worried', 'Zealous', 'Orange', 'Yellow', 'Green', 'Blue', 'Pink', 'Purple', 'Indigo', 'Violet',
                'Affectionate', 'Stubborn', 'Confused', 'Sticky', 'Slimy', 'Hairless', 'Hairy']

    normal_nouns = ['Cheetah', 'Book', 'Chair', 'Pigeon', 'Dolphin', 'Actor', 'Animal', 'Apple', 'Balloon', 'Banana', 'Battery',
            'Bed', 'Boy', 'Branch', 'Car', 'Candle', 'Carpet', 'Crayon', 'Diamond', 'Dream', 'Dress', 'Egg', 'Eggplant',
            'Elephant', 'Eye', 'Fish', 'Forest', 'Football', 'Fountain', 'Garage', 'Gold', 'Grass', 'Guitar', 'Hamburger',
            'Helmet', 'Horse', 'Penguin', 'Honey', 'Ice', 'Insect', 'Iron', 'Jelly', 'Juice', 'Kangaroo', 'Kite', 'Knife',
            'Lamp', 'Lion', 'Lizard', 'Lunch', 'Magazine', 'Monkey', 'Microphone', 'Nail', 'Needle', 'Notebook', 'Ocean',
            'Oil', 'Oyster', 'Ghost', 'Parrot', 'Piano', 'Pizza', 'Pillow', 'Planet', 'Queen', 'Rainbow', 'Restaurant',
            'River', 'Rose', 'Sandwich', 'Shampoo', 'Sugar', 'Stone', 'Spoon', 'Shoe', 'Phone', 'Telephone', 'Television',
            'Tent', 'Tomato', 'Toothbrush', 'Train', 'Truck', 'Umbrella', 'Vase', 'Vegetable', 'Vulture', 'Wall', 'Whale',
            'Wizard', 'Window', 'Wire', 'Xylophone', 'Yacht', 'Zebra', 'Glass', 'Gas', 'Budgie', 'Snake', 'Chimpanzee']

    funny_adjectives = ['Hairy', 'Crazy', 'Hysterical', 'Funny', 'Feisty', 'Chunky', 'Fluffy', 'Hungry', 'Itchy', 'Jolly',
                        'Modern', 'Naughty', 'Obnoxious', 'Outrageous', 'Smily', 'Troubled', 'Wild', 'Brown', 'Hairless',
                        'Slimy', 'Sticky', 'Confused', 'Stubborn', 'Idiotic', 'Affectionate', 'Determined', 'Feeble'
                        'Flying', 'Helpless', 'Hopeful', 'Dead']

    funny_nouns = ['Monkey', 'Toaster', 'Lettuce', 'Kitty', 'ElasticBand', 'Arms', 'Legs', 'ToiletSeat', 'DeathWish',
                   'Pigeon', 'Egg', 'Grass', 'Hamburger', 'Shampoo', 'Door', 'Wall', 'FishEye', 'FluffBall', 'Sardine',
                   'Blubber', 'Gargoyle', 'Goggles', 'Hedge', 'Shrub', 'Squelch', 'Donkey', 'Pepper']

    animal_adjectives = ['Flying', 'Epic', 'Hissing', 'Swift', 'Fast', 'Amazing', 'Growling', 'Snarling', 'Frisky',
                         'Amphibious', 'Exotic', 'Feral', 'Wild', 'Dead', 'Scary', 'Fluffy', 'Domestic', 'Tame',
                         'Vicious', 'Graceful', 'Predatory', 'Aquatic', 'Screeching', 'Adorable']

    animal_nouns = ['Cat', 'Snake', 'Dog', 'Monkey', 'Budgie', 'Bird', 'Ant', 'Anteater', 'Fish', 'Sardine', 'Chimpanzee',
                    'Clownfish', 'Lionfish', 'Bear', 'Lion', 'Tiger', 'Elephant', 'Hippo', 'Rhinoceros', 'Frog', 'Wolf',
                    'Buffalo', 'Eagle', 'Hawk', 'Albatross', 'Lynx', 'PolarBear', 'Snowcat', 'Lizard', 'Crocodile',
                    'Alligator', 'Parrot', 'Badger', 'Beaver', 'Crow', 'Squirrel', 'Dragon', 'Cheetah', 'Pigeon',
                    'Dolphin', 'Kangaroo', 'Fly', 'Insect', 'Horse', 'Penguin', 'Squid', 'Octopus', 'Vulture',
                    'Zebra', 'Kitten', 'Donkey', 'Antelope', 'Echidna', 'Pelican', 'Baboon', 'Bee', 'Swan', 'Tapir',
                    'Hyena', 'Lemur', 'Pig', 'Cow', 'Sheep', 'Camel', 'Giraffe', 'Cobra', 'Crab', 'Crane', 'Dingo',
                    'Fox', 'Dove', 'JayBird', 'Owl', 'Hedgehog', 'Elk', 'Emu', 'Falcon', 'Turtle', 'Hornet', 'Wasp',
                    'Ibis', 'Jackal', 'Koala']

    landmarks_adjectives = ['Tall', 'Sparkling', 'Dazzling', 'White', 'Sandy', 'Rocky', 'Big', 'Large', 'Golden', 'Amazing',
                            'Inccredible']

    landmarks_nouns = ['EiffelTower', 'TowerOfPisa', 'Colosseum', 'WhiteHouse', 'TajMahal', 'WallOfChina', 'StatueOfLiberty',
                       'PyramidOfGiza', 'Uluru', 'OperaHouse', 'ParliamentHouse', 'LondonEye', 'Stonehenge',
                       'GoldenGateBridge']

    food_adjectives = ['Delicious', 'Juicy', 'Luxurious', 'Warm', 'Salty', 'Spicy', 'Flavoursome', 'Bitter', 'Enjoyable',
                       'Delectable', 'Crunchy', 'Sweet', 'Sour', 'Savoury', 'Divine', 'Fruity', 'Appetising', 'Heavenly',
                       'Hot', 'Lush', 'Mouthwatering', 'Incredible', 'Horrid', 'Peppery', 'Pungent', 'Pleasant',
                       'Rich', 'Scrumptious', 'Sharp', 'Strong', 'Succulent', 'Sugary', 'Saline', 'Tasteless', 'Tasty',
                       'Yummy']

    food_nouns = ['Apple', 'Banana', 'Hamburger', 'Burger', 'Cheeseburger', 'Strawberry', 'Steak', 'Pasta', 'Mince',
                  'Fry', 'Chip', 'Avocado', 'Blueberry', 'Orange', 'Egg', 'Chicken', 'Coconut', 'Asparagus', 'Broccoli',
                  'Cauliflower', 'Carrot', 'Cucumber', 'Garlic', 'Kale', 'Tomato', 'Salmon', 'Cereal', 'Fruit',
                  'Bread', 'Cookie', 'Cheese', 'Yoghurt', 'Milk', 'Juice', 'Eggplant', 'Jelly', 'Honey', 'Pizza']

    harrypotter_adjectives = ['Magical', 'Swish', 'Flick', 'Transforming', 'Brave', 'Bold', 'Invisible', 'Dead', 'Forbidden',
                              'Mysterious', 'Secret']

    harrypotter_nouns = ['HarryPotter', 'Dumbledore', 'Snape', 'Weasley', 'Hermione', 'McGonagall', 'SiriusBlack',
                         'Hagrid', 'Hedwig', 'Dobby', 'Voldemort', 'Mad-EyeMoody', 'Malfoy', 'Lovegood', 'Longbottom',
                         'DeathlyHallows', 'Umbridge', 'Lupin', 'Scamander', 'Nagini', 'Lestrange', 'Dursley', 'Tonks',
                         'Transfiguration', 'Gryffindor', 'Ravenclaw', 'Slytherin', 'Hufflepuff', 'Hogwarts', 'Magic']

    cats_adjectives = ['Fuzzy', 'Furry', 'Agile', 'Clever', 'Precise', 'Patient', 'Hunter', 'Loud', 'Lethal', 'Lazy',
                       'Predatory', 'Energetic', 'Sleepy', 'Loyal', 'Adorable', 'Cute', 'Passionate']

    cats_nouns = ['Feline', 'Cat', 'Meow', 'Purr', 'Hiss', 'Persian', 'Bengal', 'MaineCoon', 'Siamese', 'Sphynx', 'Ragdoll',
                  'Abyssinian']

    dogs_adjectives = ['Friendly', 'Loyal', 'Loud', 'Adorable', 'Cute', 'Passionate', 'Strong', 'Smelly', 'Protective',
                       'Smart', 'Obedient']

    dogs_nouns = ['Woof', 'Dog', 'GermanShepherd', 'Labrador', 'Retriever', 'Husky', 'Poodle', 'Bulldog', 'Pug', 'Chihuahua',
                  'Rottweiler', 'Maltese', 'Terrier', 'ChowChow']

    numbers = random.randint(1,100)

    symbols = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '\'', '-', '_', '+', '=', '`', '~', '[', '{', ']', '}', '|',
             '<', '.', '>', '/', '?']

    result_normal = random.choice(normal_adjectives) + random.choice(normal_nouns)
    result_funny = random.choice(funny_adjectives) + random.choice(funny_nouns)
    result_animal = random.choice(animal_adjectives) + random.choice(animal_nouns)
    result_landmarks = random.choice(landmarks_adjectives) + random.choice(landmarks_nouns)
    result_food = random.choice(food_adjectives) + random.choice(food_nouns)
    result_potter = random.choice(harrypotter_adjectives) + random.choice(harrypotter_nouns)
    result_cats = random.choice(cats_adjectives) + random.choice(cats_nouns)
    result_dogs = random.choice(dogs_adjectives) + random.choice(dogs_nouns)

    case = input('Would you like your password in lowercase, uppercase or normal? (lower, upper, normal) ')
    number_want = input('Do you want numbers? y/n ')
    symbol_want = input('Do you want symbols? y/n ')
    theme = input('Enter in the theme for your password (normal/funny/animal/landmarks/food/harry potter/cats/dogs) ')

    if case == 'upper':
        result_normal = result_normal.upper()
        result_funny = result_funny.upper()
        result_animal = result_animal.upper()
        result_landmarks = result_landmarks.upper()
        result_food = result_food.upper()
        result_potter = result_potter.upper()
        result_cats = result_cats.upper()
        result_dogs = result_dogs.upper()

    if case == 'lower':
        result_normal = result_normal.lower()
        result_funny = result_funny.lower()
        result_animal = result_animal.lower()
        result_landmarks = result_landmarks.lower()
        result_food = result_food.lower()
        result_potter = result_potter.lower()
        result_cats = result_cats.lower()
        result_dogs = result_dogs.lower()

    if number_want == 'y':
        result_normal = result_normal + str(numbers)
        result_funny = result_funny + str(numbers)
        result_animal = result_animal + str(numbers)
        result_landmarks = result_landmarks + str(numbers)
        result_food = result_food + str(numbers)
        result_potter = result_potter + str(numbers)
        result_cats = result_cats + str(numbers)
        result_dogs = result_dogs + str(numbers)

    if symbol_want == 'y':
        result_normal = result_normal + random.choice(symbols)
        result_funny = result_funny + random.choice(symbols)
        result_animal = result_animal + random.choice(symbols)
        result_landmarks = result_landmarks + random.choice(symbols)
        result_food = result_food + random.choice(symbols)
        result_potter = result_potter + random.choice(symbols)
        result_cats = result_cats + random.choice(symbols)
        result_dogs = result_dogs + random.choice(symbols)

    if theme=='normal':
        print(result_normal)
        print('Your new password is ' + result_normal)
    elif theme=='funny':
        print(result_funny)
        print('Your new password is ' + result_funny)
    elif theme=='animal':
        print(result_animal)
        print('Your new password is ' + result_animal)
    elif theme=='landmarks':
        print(result_landmarks)
        print('Your new password is ' + result_landmarks)
    elif theme=='food':
        print(result_food)
        print('Your new password is ' + result_food)
    elif theme=='harry potter':
        print(result_potter)
        print('Your new password is ' + result_potter)
    elif theme=='cats':
        print(result_cats)
        print('Your new password is ' + result_cats)
    elif theme=='dogs':
        print(result_dogs)
        print('Your new password is ' + result_dogs)
    else:
        print(theme + ' is not a valid theme!')

    other_p = input('Would you like another password? y/n ')

    if other_p == 'y':
        password()

start = input('Welcome to the Python Password Generator! Type the word start to start! ')

if start == 'start':
    password()
else:
   print('Type \'start\' to start, not ' + start)

While this will work once you fix the indentation, this is a terrible implementation. I would suggest setting the theme first, and then adding numbers and symbols. Something like

case = input('Would you like your password in lowercase, uppercase or normal? (lower, upper, normal) ')
number_want = input('Do you want numbers? y/n ')
symbol_want = input('Do you want symbols? y/n ')
theme = input('Enter in the theme for your password (normal/funny/animal/landmarks/food/harry potter/cats/dogs) ')

if theme == 'normal':
    password = random.choice(normal_adjectives) + random.choice(normal_nouns)
elif theme == 'funny':
    password = random.choice(funny_adjectives) + random.choice(funny_nouns)
elif theme == 'animal':
    password = random.choice(animal_adjectives) + random.choice(animal_nouns)
elif theme == 'landmarks':
    password = random.choice(landmarks_adjectives) + random.choice(landmarks_nouns)
elif theme == 'food':
    password = random.choice(food_adjectives) + random.choice(food_nouns)
elif theme == 'harry potter':
    password = random.choice(harrypotter_adjectives) + random.choice(harrypotter_nouns)
elif theme == 'cats':
    password = random.choice(cats_adjectives) + random.choice(cats_nouns)
elif theme == 'dogs':
   password = random.choice(dogs_adjectives) + random.choice(dogs_nouns)
else:
    print(theme + ' is not a valid theme!')

if case == 'upper':
    password = password.upper()

if case == 'lower':
    password = password.lower()

if number_want == 'y':
    password = password + str(numbers)

if symbol_want == 'y':
    password = password + random.choice(symbols)

print("Your password is:", password)

other_p = input('Would you like another password? y/n ')

if other_p == 'y':
    password()


来源: stackexchange

问:
different types of user management on react-native
I'm new to react native. I am trying to develop an application that uses firebase user authentication. But there is something I can think of. For example, 2 users have registered to my application but I want to show extra information to the first user according to a condition.

How can I separate these two?

Where exactly should I manage this condition?

答:
The question is not super clear as to what issue you are trying to tackle so I apologize if I am inferring incorrectly.

I use MongoDB personally with a Node/Express backend for user data and haven't used Firebase myself but I'm sure you can do the same things with it.  I'll be speaking in Mongo terminology but again I'm sure you can do the same with Firebase and at the least this will give a good idea of the thought process.

I have a UserSchema that holds all the user information.  When logged in the client app would get this information to be used on the frontend after authentication.

Assuming you are only displaying "extra" information that doesn't need additional privilege you can just pull in the users data stored in firebase and handle the display of this extra info with logic on your frontend client.

If its extra privilege you need to setup firebase to look at the user data that is authenticating and only serve back information if they have the proper privileges.

Also important to note, you should ensure that when you are updating user information from client -> firebase backend you should ensure that you can only update specific user fields via read/write authentication on firebase.

Hope this gives a little better idea on how this process might look.  I'll let someone who has used firebase specifically add tech specifics.

ContentLicense: CC BY-SA 4.0


问:
Bitwise operation && overflow
Why the results of this two lines are different in java? </p>

```<code>int a = 1;
System.out.println(a << 32); //output: 1
System.out.println(a << 31 << 1); //output: 0
</code>```

答:
Per JLS 8 § 15.19

If the promoted type of the left-hand operand is int, then only the
  five lowest-order bits of the right-hand operand are used

When shifting an int the shift distance is thus effectively the value of the right operand mod 32 (at least when the right operand is non-negative).  So a << 32 is basically the same as a << 0, i.e., just a.  But a << 31 << 1 first shifts a, whose value is 0x00000001, left by 31 to yield 0x80000000, which is then shifted left by 1 to yield 0x00000000.

Title: Bitwise operation && overflow

Body:
Why the results of this two lines are different in java?

int a = 1;
System.out.println(a << 32); //output: 1
System.out.println(a << 31 << 1); //output: 0


问:
can someone please explain REQ in express plz
I dont get how we use req in express. I undrstand that the server can respond back to client,but when it comes to req object im confused. Is req when the server is asking for somethong from the client?

答:
With an express server, you get two objects passed to a request handler.

req is data about the incoming request (things that were sent from the client).  It contains the headers on the request, it contains a parsed query string, it contains the URL path, it's generally the object where middleware puts things for request handlers to use.  While Express adds a bit more to this object, you can see the general concept of the req object by looking and the http.IncomingMessage object documented here.  This is what the object starts out as and then Express adds more to it.  The express version of the object is documented here.

res is the response object.  This is all about sending a response.  It will hold the outbound headers you want to send with the request.  It contains the methods you use for sending a response.  The core object is an http.ServerResponse object documented here and then Express adds some more things to the object on top of that which is document here.


问:
ASP.NET Server Controls Tag for Role Based Authorization
I've got a web form with lots fields and buttons. These fields and buttons should be enabled and disabled based on users Role i.e. 'employee', 'team leader', 'manager' etc.

Is there a way to tag each fields such as emp for employee, tm for teamleader so that I can enable or disable them with 1 or 2 lines of code?

Otherwise I will have to write lots of if else statement for each controls.

thank you

答:
You can create WebControl[] arrays in the code-behind containing the controls visible to each role:

```<code>WebControl[] managerControls = { someControl, otherButton, ... };
</code>```

ContentLicense: CC BY-SA 3.0

Body:
You can create WebControl[] arrays in the code-behind containing the controls visible to each role:

WebControl[] managerControls = { someControl, otherButton, ... };


问:
Can Not Store Data From Contact Form To Firebase
I am trying to send the data of my user to firebase using the code given below:

```<code>var firestore =  firebase.firestore();

var messagesRef = firestore.collection("BookingData");

//listen for submit
document.getElementById('bookingForm').addEventListener('submit',submitForm);

function submitForm(e){
 e.preventDefault();

 //get values
var email = getInputVal('email');
var packageFields = getInputVal('packageFields');
var name = getInputVal('name');
var phone = getInputVal('phone');
var date = getInputVal('date');

}

// function to get form values

 function getInputVal(id) {
return document.getElementById(id).value;
 }

//save messages

function saveMessage(email, packageFields, name, phone, date) {

  messageRef.add({
   email:email,
   packageFields:packageFields,
   name:name,
   phone:phone,
   date:date
   }).then(function(docRef) {
console.log("Document written with ID: ", docRef.id);
})
 .catch(function(error) {
  console.error("Error adding document: ", error);
});

  }
</code>```

But nothing is happening.

I am not able to send the data to firebase databse.

it also shows a warning called:

[2020-05-30T03:38:27.083Z]  @firebase/app:
      Warning: Firebase is already defined in the global scope. Please make sure
      Firebase library is only loaded once.

How can I Solve this problem? Please Help/\

Thanks in advance.

答:
Ok, I got The Error I was Not calling The Function. The correct code is: </p>

```<code>var firestore =  firebase.firestore();

var messagesRef = firestore.collection("BookingData");

//listen for submit
document.getElementById('bookingForm').addEventListener('submit',submitForm);

function submitForm(e){
 e.preventDefault();

 //get values
var email = getInputVal('email');
var packageFields = getInputVal('packageFields');
var name = getInputVal('name');
var phone = getInputVal('phone');
var date = getInputVal('date');

saveMessage(email, packageFields, name, phone, date);
}

// function to get form values

 function getInputVal(id) {
return document.getElementById(id).value;
 }

//save messages

function saveMessage(email, packageFields, name, phone, date) {

  messageRef.add({
   email:email,
   packageFields:packageFields,
   name:name,
   phone:phone,
   date:date
   }).then(function(docRef) {
console.log("Document written with ID: ", docRef.id);
})
 .catch(function(error) {
  console.error("Error adding document: ", error);
});

}
</code>```

Body:
I am trying to send the data of my user to firebase using the code given below:

var firestore =  firebase.firestore();

var messagesRef = firestore.collection("BookingData");

//listen for submit
document.getElementById('bookingForm').addEventListener('submit',submitForm);

function submitForm(e){
 e.preventDefault();

 //get values
var email = getInputVal('email');
var packageFields = getInputVal('packageFields');
var name = getInputVal('name');
var phone = getInputVal('phone');
var date = getInputVal('date');

}

// function to get form values

 function getInputVal(id) {
return document.getElementById(id).value;
 }

//save messages

function saveMessage(email, packageFields, name, phone, date) {

  messageRef.add({
   email:email,
   packageFields:packageFields,
   name:name,
   phone:phone,
   date:date
   }).then(function(docRef) {
console.log("Document written with ID: ", docRef.id);
})
 .catch(function(error) {
  console.error("Error adding document: ", error);
});

  }

But nothing is happening.

I am not able to send the data to firebase databse.

it also shows a warning called:

[2020-05-30T03:38:27.083Z]  @firebase/app:
      Warning: Firebase is already defined in the global scope. Please make sure
      Firebase library is only loaded once.

How can I Solve this problem? Please Help/\

Thanks in advance.

Body:
Ok, I got The Error I was Not calling The Function. The correct code is:

var firestore =  firebase.firestore();

var messagesRef = firestore.collection("BookingData");

//listen for submit
document.getElementById('bookingForm').addEventListener('submit',submitForm);

function submitForm(e){
 e.preventDefault();

 //get values
var email = getInputVal('email');
var packageFields = getInputVal('packageFields');
var name = getInputVal('name');
var phone = getInputVal('phone');
var date = getInputVal('date');

saveMessage(email, packageFields, name, phone, date);
}

// function to get form values

 function getInputVal(id) {
return document.getElementById(id).value;
 }

//save messages

function saveMessage(email, packageFields, name, phone, date) {

  messageRef.add({
   email:email,
   packageFields:packageFields,
   name:name,
   phone:phone,
   date:date
   }).then(function(docRef) {
console.log("Document written with ID: ", docRef.id);
})
 .catch(function(error) {
  console.error("Error adding document: ", error);
});

}


问:
Python flask webpage trying to create a single item details page from multiple products
I am doing a flask website project and im trying to get create an individual item page for each of my items. Im using sqlite for the database.

Below is the html code

```<code>{% extends 'base.html' %}

{% block main %}
<!-- display products for the different categories stock -->
<section>

    <div class="text-dark text-center">
        <div>
            <p class="h3 text-dark mb-4">New Arrival</p>
        </div>
    </div>

    <div class="card-deck">
        <!-- each product is a bootstrap card -->
        {% for product in products%}
        <div class="card">
            <img class="card-img-top" src="{{url_for('static', filename='img/'+product.image)}}" alt="Card image">
            <div class="card-body">
                <h4 class="card-title">{{product.name}}</h4>
                <p class="card-text">{{product.description}}</p>

            </div>
            <div class="card-footer">

                <form action="{{ url_for('main.order') }}">
                    <input type="hidden" id="product_id" name="product_id" value="{{ product.id }}">
                    <input class="btn btn-primary" type="submit" value="Add to Cart">
                </form>

                <div class="card-footer"><a href= "{{ url_for('main.itemdetails', productid=product.id) }}" class="btn btn-primary">Item Details</a></div>

            </div>
        </div>
        {% endfor %}
    </div>

</section>
{% endblock %}
</code>```

using route

```<code>@bp.route('/<int:productid>/')
def itemdetails():
    products= Product.query.one('productid')
    return render_template('itemdetails.html', products = products)
</code>```

my itemdetails.html page:

```<code>{% extends 'base.html' %}

{% block main %}
>
    <div class="text-dark text-center">
        <div>
            <p class="h3 text-dark mb-4" id="cities_anchor">Available Products</p>
        </div>
    </div>
    <div class="card-deck">

        {% for product in products%}
        <div class="card">
            <img class="card-img-top" src="{{url_for('static', filename='img/'+product.image)}}" alt="Card image">
            <div class="card-body">
                <h4 class="card-title">{{product.name}}</h4>
                <p class="card-text">{{product.description}}</p>
            </div>
            <div class="card-footer">
                <form action="{{ url_for('main.order') }}">
                <input type="hidden" id="product_id" name="product_id" value="{{ product.id }}">
                <input class="btn btn-primary" type="submit" value="Add to Cart">
                </form>
            </div>
        </div>
        {% endfor %}
    </div>
</section>
{% endblock %}
</code>```

getting error message
TypeError: itemdetails() got an unexpected keyword argument 'productid'

The problem is i need a interactive item details that only shows information of the product that the user was clicked on. How can i do that?

My Database

```<code>from . import db

class Stock(db.Model):
    __tablename__='stocks'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64), unique=True)
    description = db.Column(db.String(500), nullable=False)
    image = db.Column(db.String(60), nullable=False, default = 'barbel.jpg')
    products = db.relationship('Product', backref='Stock', cascade="all, delete-orphan")

    def __repr__(self):
        str = "Id: {}, Name: {}, Description: {}, Image: {}\n"
        str =str.format( self.id, self.name,self.description,self.image)
        return str

orderdetails = db.Table('orderdetails',
    db.Column('order_id', db.Integer,db.ForeignKey('orders.id'), nullable=False),
    db.Column('product_id',db.Integer,db.ForeignKey('products.id'),nullable=False),
    db.PrimaryKeyConstraint('order_id', 'product_id') )

class Product(db.Model):
    __tablename__='products'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64),nullable=False)
    description = db.Column(db.String(500), nullable=False)
    image = db.Column(db.String(60), nullable=False)
    price = db.Column(db.Float, nullable=False)
    date = db.Column(db.DateTime, nullable=False)
    stock_id = db.Column(db.Integer, db.ForeignKey('stocks.id'))

    def __repr__(self):
        str = "Id: {}, Name: {}, Description: {}, Image: {}, Price: {}, Stock: {}, Date: {}\n"
        str =str.format( self.id, self.name,self.description,self.image, self.price, self.stock_id, self.date)
        return str

class Order(db.Model):
    __tablename__='orders'
    id = db.Column(db.Integer, primary_key=True)
    status = db.Column(db.Boolean, default=False)
    firstname = db.Column(db.String(64))
    phone = db.Column(db.String(32))
    email = db.Column(db.String(128))
    address = db.Column(db.String(128))
    postcode = db.Column(db.String(32))
    city = db.Column(db.String(32))
    state = db.Column(db.String(32))
    totalcost = db.Column(db.Float)
    date = db.Column(db.DateTime)
    products = db.relationship("Product", secondary=orderdetails, backref="orders")

    def __repr__(self):
        str = "id: {}, Status: {}, Firstname: {}, Phone: {}, Email: {}, Address: {}, Postcode: {}, City: {}, State: {},  Date: {}, Products: {}, Total Cost: {}\n"
        str =str.format( self.id, self.status,self.firstname,self.phone, self.email, self.address, self.postcode, self.city, self.state, self.date, self.products, self.totalcost)
        return str
</code>```

答:
With our seeing your Database Schema I am not 100% sure, but I would bet that you need to change productId to just id.

EDIT:

After looking at the Models that you posted you do not have a productid in the model.  You do have an id.  Change productId to id and that should solve your issue.

Body:
I am doing a flask website project and im trying to get create an individual item page for each of my items. Im using sqlite for the database.

Below is the html code

{% extends 'base.html' %}

{% block main %}

New Arrival

        {% for product in products%}

{{product.name}}

{{product.description}}

                <form action="{{ url_for('main.order') }}">
                    <input type="hidden" id="product_id" name="product_id" value="{{ product.id }}">
                    <input class="btn btn-primary" type="submit" value="Add to Cart">
                </form>

Item Details

        {% endfor %}

{% endblock %}

using route

@bp.route('/<int:productid>/')
def itemdetails():
    products= Product.query.one('productid')
    return render_template('itemdetails.html', products = products)

my itemdetails.html page:

{% extends 'base.html' %}

{% block main %}
>

Available Products

        {% for product in products%}

{{product.name}}

{{product.description}}

                <form action="{{ url_for('main.order') }}">
                <input type="hidden" id="product_id" name="product_id" value="{{ product.id }}">
                <input class="btn btn-primary" type="submit" value="Add to Cart">
                </form>

        {% endfor %}

{% endblock %}

getting error message
TypeError: itemdetails() got an unexpected keyword argument 'productid'

The problem is i need a interactive item details that only shows information of the product that the user was clicked on. How can i do that?

My Database

from . import db

class Stock(db.Model):
    __tablename__='stocks'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64), unique=True)
    description = db.Column(db.String(500), nullable=False)
    image = db.Column(db.String(60), nullable=False, default = 'barbel.jpg')
    products = db.relationship('Product', backref='Stock', cascade="all, delete-orphan")

    def __repr__(self):
        str = "Id: {}, Name: {}, Description: {}, Image: {}\n"
        str =str.format( self.id, self.name,self.description,self.image)
        return str

orderdetails = db.Table('orderdetails',
    db.Column('order_id', db.Integer,db.ForeignKey('orders.id'), nullable=False),
    db.Column('product_id',db.Integer,db.ForeignKey('products.id'),nullable=False),
    db.PrimaryKeyConstraint('order_id', 'product_id') )

class Product(db.Model):
    __tablename__='products'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64),nullable=False)
    description = db.Column(db.String(500), nullable=False)
    image = db.Column(db.String(60), nullable=False)
    price = db.Column(db.Float, nullable=False)
    date = db.Column(db.DateTime, nullable=False)
    stock_id = db.Column(db.Integer, db.ForeignKey('stocks.id'))

    def __repr__(self):
        str = "Id: {}, Name: {}, Description: {}, Image: {}, Price: {}, Stock: {}, Date: {}\n"
        str =str.format( self.id, self.name,self.description,self.image, self.price, self.stock_id, self.date)
        return str

class Order(db.Model):
    __tablename__='orders'
    id = db.Column(db.Integer, primary_key=True)
    status = db.Column(db.Boolean, default=False)
    firstname = db.Column(db.String(64))
    phone = db.Column(db.String(32))
    email = db.Column(db.String(128))
    address = db.Column(db.String(128))
    postcode = db.Column(db.String(32))
    city = db.Column(db.String(32))
    state = db.Column(db.String(32))
    totalcost = db.Column(db.Float)
    date = db.Column(db.DateTime)
    products = db.relationship("Product", secondary=orderdetails, backref="orders")

    def __repr__(self):
        str = "id: {}, Status: {}, Firstname: {}, Phone: {}, Email: {}, Address: {}, Postcode: {}, City: {}, State: {},  Date: {}, Products: {}, Total Cost: {}\n"
        str =str.format( self.id, self.status,self.firstname,self.phone, self.email, self.address, self.postcode, self.city, self.state, self.date, self.products, self.totalcost)
        return str


答:
For that particular error the fix is that you need to provide the keyword argument productid like this:

```<code>@bp.route('/<int:productid>/')
def itemdetails(productid=None):
    #           ^^^^^^^^^^^^^^
    products= Product.query.filter(id==productid).first()
    #                                  ^^^^^^^^^
    return render_template('itemdetails.html', products = products)
</code>```

And then notice how it's the variable productid and not the string that's being passed to the query.

Title: Python flask webpage trying to create a single item details page from multiple products

Body:
For that particular error the fix is that you need to provide the keyword argument productid like this:

@bp.route('/<int:productid>/')
def itemdetails(productid=None):
    #           ^^^^^^^^^^^^^^
    products= Product.query.filter(id==productid).first()
    #                                  ^^^^^^^^^
    return render_template('itemdetails.html', products = products)

And then notice how it's the variable productid and not the string that's being passed to the query.


问:
Using a limit on a left join in mysql
The following query selects all posts and each post's owner, all of the comments that belong to each post, and the owner of each comment.

I need to only retrieve 5 comments per post. I rewrote the query, but I get an error of "each derived table must have it's own alias".

```<code>SELECT posts.id AS postId, posts.body, users.id AS userId, users.displayname, comments.id AS commentId, comments.text, commenters.id, commenters.displayname
FROM posts
JOIN users ON posts.owneruserid = users.id
LEFT JOIN comments ON posts.id = comments.postid
    JOIN users AS commenters ON comments.userId = commenters.id
ORDER BY posts.createdAt
</code>```

New Query:

```<code>SELECT posts.id AS postId, posts.body, users.id AS userId, users.displayname
FROM posts
JOIN users ON posts.owneruserid = users.id
LEFT JOIN (
    SELECT comments.id AS commentId, comments.text AS commentText, commenters.id AS commenterId, commenters.displayname AS commenterDisplayName
    FROM comments
    JOIN users AS commenters ON comments.userid = commenters.id
    LIMIT 0,5
        ) AS comments ON comments.postid = posts.id
ORDER BY posts.createdAt
</code>```

UPDATE The query now works, but it does not produce the desired output. I want to output 10 posts, with 5 comments for each post. This limit clause will only apply for the comments of the first post encountered.

答:
Since you're using a subquery (which is what it means by "derived table"), it must indeed have an alias. Thus, all you need to do is:

```<code>SELECT posts.id AS postId, posts.body, users.id AS userId, users.displayname
FROM posts
JOIN users ON posts.owneruserid = users.id
LEFT JOIN (
    SELECT comments.id AS commentId, comments.text AS commentText, commenters.id AS commenterId, commenters.displayname AS commenterDisplayName
    FROM comments
    JOIN users AS commenters ON comments.userid = commenters.id
    LIMIT 0,5
) as some_alias --This is what's triggering the error
ORDER BY posts.createdAt
</code>```

Even if you're not selecting from the subquery, and just using it as a filter, you have to alias it.

Title: Using a limit on a left join in mysql

Body:
The following query selects all posts and each post's owner, all of the comments that belong to each post, and the owner of each comment.

I need to only retrieve 5 comments per post. I rewrote the query, but I get an error of "each derived table must have it's own alias".

SELECT posts.id AS postId, posts.body, users.id AS userId, users.displayname, comments.id AS commentId, comments.text, commenters.id, commenters.displayname
FROM posts
JOIN users ON posts.owneruserid = users.id
LEFT JOIN comments ON posts.id = comments.postid
    JOIN users AS commenters ON comments.userId = commenters.id
ORDER BY posts.createdAt

New Query:

SELECT posts.id AS postId, posts.body, users.id AS userId, users.displayname
FROM posts
JOIN users ON posts.owneruserid = users.id
LEFT JOIN (
    SELECT comments.id AS commentId, comments.text AS commentText, commenters.id AS commenterId, commenters.displayname AS commenterDisplayName
    FROM comments
    JOIN users AS commenters ON comments.userid = commenters.id
    LIMIT 0,5
        ) AS comments ON comments.postid = posts.id
ORDER BY posts.createdAt

UPDATE The query now works, but it does not produce the desired output. I want to output 10 posts, with 5 comments for each post. This limit clause will only apply for the comments of the first post encountered.

Body:
Since you're using a subquery (which is what it means by "derived table"), it must indeed have an alias. Thus, all you need to do is:

SELECT posts.id AS postId, posts.body, users.id AS userId, users.displayname
FROM posts
JOIN users ON posts.owneruserid = users.id
LEFT JOIN (
    SELECT comments.id AS commentId, comments.text AS commentText, commenters.id AS commenterId, commenters.displayname AS commenterDisplayName
    FROM comments
    JOIN users AS commenters ON comments.userid = commenters.id
    LIMIT 0,5
) as some_alias --This is what's triggering the error
ORDER BY posts.createdAt

Even if you're not selecting from the subquery, and just using it as a filter, you have to alias it.


问:
Python3 newbie needing advice
Hey everyone I am brand new to coding and back end computing in general. I have been at it about 3 weeks and thought I would take a crack at writing my first app. Most of my app is working just fine but I cannot figure out how to get the system to accept the new input and apply it to my functions after loop() runs. help please!</p>

```<code>from os import sys

def say_bye():
    print("GoodBye!")
    sys.exit()

def loop():
    print()
    print("Would you like to enter another value?")
    choice2 = input('y/n: ')
    if choice2 == 'y':
        print()
        amount = float(input("enter another price: "))
        rate = float(input("tax rate: "))
        print()
        return in_page(), tot_with_tax_exit(), print(tot_with_tax()), loop()
    else:
        return say_bye()

def tot_with_tax():
    tax = (amount * rate)
    total = ("Your total after tax is", tax + amount)
    return total

def tot_with_tax_exit():
    if amount == int(0):
        print('would you like to exit')
        choice = input('y/n?: ')
        if choice == 'y':
            print()
            return say_bye()
        else:
            return tot_with_tax()

def in_page():
    print()
    print("Welcome to the tax tool!")
    print()
    print("Please enter your total price, and tax rate.")

in_page()
amount = float(input("enter price: "))
tot_with_tax_exit()
rate = float(input("tax rate: "))
print(tot_with_tax())
loop()
</code>```

答:
To validate user inputs, use a while True loop.

while True:
    name = input("What's your name?: ")
    if name != "": # If the user entered a name
        break # Exit the loop
    # Else the program will keep asking
    # Until the user enters name.
```

<p>Here's a simplified version of your code with that implemented:</p>

<pre class="lang-py prettyprint-override"><code>from os import sys

print("Welcome to the tax tool!")
print()
print("Please enter your total price, and tax rate.")

def taxed(amount, rate):
    tax = amount * rate
    total = "Your total after tax is $" + str(tax + amount)
    return total

while True:
    amount = float(input("Enter price: "))
    rate = float(input("Tax Rate: "))

    if amount >= 0 and rate >= 0:
        print (taxed(amount, rate))

        while True:
            again = input("Would you like to enter another value? (y/n): ")
            if again == "n":
                print("GoodBye!")
                sys.exit()
            if again == "y":
                break
</code>```

Title: Python3 newbie needing advice

Body:
Hey everyone I am brand new to coding and back end computing in general. I have been at it about 3 weeks and thought I would take a crack at writing my first app. Most of my app is working just fine but I cannot figure out how to get the system to accept the new input and apply it to my functions after loop() runs. help please!

from os import sys

def say_bye():
    print("GoodBye!")
    sys.exit()

def loop():
    print()
    print("Would you like to enter another value?")
    choice2 = input('y/n: ')
    if choice2 == 'y':
        print()
        amount = float(input("enter another price: "))
        rate = float(input("tax rate: "))
        print()
        return in_page(), tot_with_tax_exit(), print(tot_with_tax()), loop()
    else:
        return say_bye()

def tot_with_tax():
    tax = (amount * rate)
    total = ("Your total after tax is", tax + amount)
    return total

def tot_with_tax_exit():
    if amount == int(0):
        print('would you like to exit')
        choice = input('y/n?: ')
        if choice == 'y':
            print()
            return say_bye()
        else:
            return tot_with_tax()

def in_page():
    print()
    print("Welcome to the tax tool!")
    print()
    print("Please enter your total price, and tax rate.")

in_page()
amount = float(input("enter price: "))
tot_with_tax_exit()
rate = float(input("tax rate: "))
print(tot_with_tax())
loop()

Body:
To validate user inputs, use a while True loop.

while True:
    name = input("What's your name?: ")
    if name != "": # If the user entered a name
        break # Exit the loop
    # Else the program will keep asking
    # Until the user enters name.

Here's a simplified version of your code with that implemented:

from os import sys

print("Welcome to the tax tool!")
print()
print("Please enter your total price, and tax rate.")

def taxed(amount, rate):
    tax = amount * rate
    total = "Your total after tax is $" + str(tax + amount)
    return total

while True:
    amount = float(input("Enter price: "))
    rate = float(input("Tax Rate: "))

    if amount >= 0 and rate >= 0:
        print (taxed(amount, rate))

        while True:
            again = input("Would you like to enter another value? (y/n): ")
            if again == "n":
                print("GoodBye!")
                sys.exit()
            if again == "y":
                break


问:
how do I make an element not work as href in an entire href card

So I have this card that works as an entire link but inside that, I have an icon under a span tag and I don't want it to work as the card's link rather just act like an icon, Ik I can solve this if I don't make the entire card href but then I'd have to manually turn all the required elements present inside the card into href which I feel like isn't efficient and neat. So any suggestions on how do I go from here?

```<code>.card {
  width: 250px;
  height: 350;
  border-radius: 10px;
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
  background-color: white;
  margin-left: 30px;
  margin-right: 30px;
  margin-top: 30px;
  margin-bottom: 30px;
  cursor: pointer;
}

.top {
  display: flex;
  justify-content: space-between;

}

.year {
  padding-top: 5px;
  padding-left: 5px;
  font-family: Circular Std Book;

}

.span-bookmark {
  padding-left: 5px;
  cursor: pointer;

}

{% for m in mlist %}
    <div class="card">
        <a href="http://www.google.com/search?q={{m.Name}}" target="_blank">
            <div class="top">
                <div class="year">{{m.Year}}</div>
                <span class="span-bookmark"><i class="material-icons bookmark" id="bookmark-style">bookmark</i></span>
            </div>

            <div class="middle">
                <div class="img-container"><img src="{{ m.Image.url }}"></div>
            </div>

            <div class="bottom">
                <div class="title">{{m.Name}}</div>
                <div class="target_id">{{m.targetid}}</div>
            </div>
        </a>
    </div>
{% endfor %}
</code>```

答:
You can stop navigation with preventDefault and stop bubbling up to the link with stopPropagation.

In the following demo, clicking on the img doesn't bubble up the DOM. Clicking on the div outside the img bubbles up to the A, as does clicking on the A text.

function showStuff(event) {
  // Stop default action, e.g. following a link
  event.preventDefault();
  // Stop click from bubbling, e.g. to link parent
  event.stopPropagation();
  // Just for demonstration purposes, delete when no longer required
  console.log('Click from ' + event.target.tagName +
    ' reached ' + event.currentTarget.tagName);
}

window.onload = function() {

  // This listener is for demo only and prevents following the link
  // Don't add it if you want to follow the link for clicks outside the img
  let link = document.querySelector('a');
  link.addEventListener('click', showStuff, false);

  // This listener stops clicks from the img reaching the A and
  // stops navigation from clicks on the img
  let img = document.querySelector('img');
  img.addEventListener('click', showStuff, false);
}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.card {
  width: 250px;
  height: 350;
  border-radius: 10px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  background-color: white;
  margin: 30px;
  cursor: pointer;
  border: 1px solid green;
}

.middle {
  margin: 20px;
  border: 1px solid blue;
}

img {
  height: 50px;
  width: 50px;
  margin: 20px;
  border: 1px solid red;
  cursor: default;
}</code>```

  Some link text

    Some more link text

```

Body:
So I have this card that works as an entire link but inside that, I have an icon under a span tag and I don't want it to work as the card's link rather just act like an icon, Ik I can solve this if I don't make the entire card href but then I'd have to manually turn all the required elements present inside the card into href which I feel like isn't efficient and neat. So any suggestions on how do I go from here?

.card {
  width: 250px;
  height: 350;
  border-radius: 10px;
  box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
  background-color: white;
  margin-left: 30px;
  margin-right: 30px;
  margin-top: 30px;
  margin-bottom: 30px;
  cursor: pointer;
}

.top {
  display: flex;
  justify-content: space-between;

}

.year {
  padding-top: 5px;
  padding-left: 5px;
  font-family: Circular Std Book;

}

.span-bookmark {
  padding-left: 5px;
  cursor: pointer;

}

{% for m in mlist %}

{{m.Year}}

                bookmark

{{m.Name}}

{{m.targetid}}

{% endfor %}

Body:
You can stop navigation with preventDefault and stop bubbling up to the link with stopPropagation.

In the following demo, clicking on the img doesn't bubble up the DOM. Clicking on the div outside the img bubbles up to the A, as does clicking on the A text.

function showStuff(event) {
  // Stop default action, e.g. following a link
  event.preventDefault();
  // Stop click from bubbling, e.g. to link parent
  event.stopPropagation();
  // Just for demonstration purposes, delete when no longer required
  console.log('Click from ' + event.target.tagName +
    ' reached ' + event.currentTarget.tagName);
}

window.onload = function() {

  // This listener is for demo only and prevents following the link
  // Don't add it if you want to follow the link for clicks outside the img
  let link = document.querySelector('a');
  link.addEventListener('click', showStuff, false);

  // This listener stops clicks from the img reaching the A and
  // stops navigation from clicks on the img
  let img = document.querySelector('img');
  img.addEventListener('click', showStuff, false);
}

.card {
  width: 250px;
  height: 350;
  border-radius: 10px;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
  background-color: white;
  margin: 30px;
  cursor: pointer;
  border: 1px solid green;
}

.middle {
  margin: 20px;
  border: 1px solid blue;
}

img {
  height: 50px;
  width: 50px;
  margin: 20px;
  border: 1px solid red;
  cursor: default;
}

<div class="card">
  <a href="http://www.google.com/search?q={{m.Name}}" target="_blank">Some link text
    <div class="middle">
      <div class="img-container"><img src="foo.jpg"></div>
    </div>
    Some more link text
  </a>
</div>


问:
How to get end time as float in Android
I had a String time format like 08:25 now how can I convert to float time value

```<code>    String guestclosetime = getCurrentTime();
    SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm");

    timeFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
    try {

        System.out.println("starttime"+ TestRideFragment.getCurrentTime());
        // convert12to24format(guestclosetime);
        Date date1 = timeFormat.parse("00:20");//run
        Date date2 = timeFormat.parse(guestclosetime);
        //Date date3=timeFormat.parse(idle_time);

        long sum = date1.getTime() + date2.getTime();

        String date3 = timeFormat.format(new Date(sum));
        System.out.println("The sum is "+date3);// 08:28
</code>```

now I need the date3 as float how can I do in android.

see I had a scenario as a driver drops a person at x place here I get the current time like 08:30 AM. and after dropping he needs to reach his destination and he took 20 mins this is in float need to convert as a string and if we add this 2 we need to get the total time as 08:50 now this total time need to save as float

I need like 1.30 = 1.5 like that

答:
Is that your goal?

"1:30" => 1.5 "1.83" => 1.83 "0.5" => 0.5

If you try it right

```<code>public static float HoursToFloat(String tmpHours)  {
    float result = 0;
    tmpHours = tmpHours.trim();
    try {
        result = new Float(tmpHours);
    } catch (NumberFormatException nfe) {

        if (tmpHours.contains(":")) {
            int hours = 0;
            float minutes = 0;
            try {
                hours = Integer.parseInt(tmpHours.split(":")[0]);
                minutes = Integer.parseInt(tmpHours.split(":")[1]);
            } catch (Exception nfe2) {
                throw nfe2;
            }

            if (minutes > 0) {
                result = minutes / 60;
            }
            result += hours;
        }
    }
    return result;
}
</code>```

Title: How to get end time as float in Android

Body:
I had a String time format like 08:25 now how can I convert to float time value

    String guestclosetime = getCurrentTime();
    SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm");

    timeFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
    try {

        System.out.println("starttime"+ TestRideFragment.getCurrentTime());
        // convert12to24format(guestclosetime);
        Date date1 = timeFormat.parse("00:20");//run
        Date date2 = timeFormat.parse(guestclosetime);
        //Date date3=timeFormat.parse(idle_time);

        long sum = date1.getTime() + date2.getTime();

        String date3 = timeFormat.format(new Date(sum));
        System.out.println("The sum is "+date3);// 08:28

now I need the date3 as float how can I do in android.

see I had a scenario as a driver drops a person at x place here I get the current time like 08:30 AM. and after dropping he needs to reach his destination and he took 20 mins this is in float need to convert as a string and if we add this 2 we need to get the total time as 08:50 now this total time need to save as float

I need like 1.30 = 1.5 like that

Body:
Is that your goal?

"1:30" => 1.5 "1.83" => 1.83 "0.5" => 0.5

If you try it right

public static float HoursToFloat(String tmpHours)  {
    float result = 0;
    tmpHours = tmpHours.trim();
    try {
        result = new Float(tmpHours);
    } catch (NumberFormatException nfe) {

        if (tmpHours.contains(":")) {
            int hours = 0;
            float minutes = 0;
            try {
                hours = Integer.parseInt(tmpHours.split(":")[0]);
                minutes = Integer.parseInt(tmpHours.split(":")[1]);
            } catch (Exception nfe2) {
                throw nfe2;
            }

            if (minutes > 0) {
                result = minutes / 60;
            }
            result += hours;
        }
    }
    return result;
}


问:
What is the name of the Google PageSpeed User Agent?
This page indicates that it uses a custom user agent but it does not mention the name. I would like to be able to run some logic if the user agent is from PageSpeed. What is the name of the Google PageSpeed user agent?</p>

答:
May 2020, there you go:

Mobile:

Mozilla/5.0 (Linux; Android 7.0; Mo
  to G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4143.7 Mobile Safari/537.36 Chrome-Lighthouse

Desktop:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4143.7 Safari/537.36 Chrome-Lighthouse


问:
Typescript Map all enum values as key
I declare a map so I can convert the numeric enum value into the value our API expects.

export const StatusMap: ReadonlyMap<Status, string> = new Map([
    [Status.NEW, 'new'],
    [Status.PENDING, 'pending'],
]);
```

<p>But when I do <code>statusMap.get(Status.NEW)</code> it always tells me that the return value is possibly undefined. Is there a way to force a map (or similar) to contain all enum values?</p>

<p>And yes I know you can technically do</p>

<pre class="lang-js prettyprint-override"><code>export enum Status {
    NEW = 'new',
    PENDING = 'pending',
}
</code>```

but let's be honest, this kind of ruins the point of enums (IMO).

答:
If you can use regular object instead of Map, it can be defined as Record of enum members:

```<code>const statusMap: Record<Status, string> = {
    [Status.NEW]: 'new',
    [Status.PENDING]: 'pending',
};
</code>```

Playground

Another option would be using type assertion that guarantees that all enum members are in the map:

```<code>type StatusMap = { get<T extends Status>(status: T): string }

const statusMap = new Map([
    [Status.NEW, 'new'],
    [Status.PENDING, 'pending'],
]) as StatusMap;
</code>```

** Pay attention, with this approach it is not guaranteed that all the enum members are in the map at runtime, so if you choose to go this way - better to cover it by unit test.

Title: Typescript Map all enum values as key

Body:
I declare a map so I can convert the numeric enum value into the value our API expects.

export const StatusMap: ReadonlyMap<Status, string> = new Map([
    [Status.NEW, 'new'],
    [Status.PENDING, 'pending'],
]);

But when I do statusMap.get(Status.NEW) it always tells me that the return value is possibly undefined. Is there a way to force a map (or similar) to contain all enum values?

And yes I know you can technically do

export enum Status {
    NEW = 'new',
    PENDING = 'pending',
}

but let's be honest, this kind of ruins the point of enums (IMO).

Body:
If you can use regular object instead of Map, it can be defined as Record of enum members:

const statusMap: Record<Status, string> = {
    [Status.NEW]: 'new',
    [Status.PENDING]: 'pending',
};

Playground

Another option would be using type assertion that guarantees that all enum members are in the map:

type StatusMap = { get<T extends Status>(status: T): string }

const statusMap = new Map([
    [Status.NEW, 'new'],
    [Status.PENDING, 'pending'],
]) as StatusMap;

** Pay attention, with this approach it is not guaranteed that all the enum members are in the map at runtime, so if you choose to go this way - better to cover it by unit test.


答:
I assume you want to fill in the quantities amount and rate in your function tot_with_tax(). In that case you might want to pass in the arguments into the function.

Thus the function handle would be:

```<code>def tot_with_tax(amount, rate):
</code>```

And you would call it by saying:

```<code>return in_page(), tot_with_tax_exit(amount, rate), print(tot_with_tax(amount, rate)), loop()
</code>```

When calling tot_with_tax(), you don't need to name the arguments amount and rate if you don't want to, for example, if you had two states i.e CA and FL, you could pass in:

```<code>return tot_with_tax(amount_CA, rate_CA)

or

return tot_with_tax(amount_FL, rate_FL)
</code>```

And either would get translated into an amount and rate inside the function.

Also one quick tip, you don't want to put in arbitrary parenthesis in python, since that signifies a type of variable called a tuple.

So instead of doing this:

```<code>tax = (amount * rate)
</code>```

Do this:

```<code>tax = amount * rate
</code>```

Title: Python3 newbie needing advice

Body:
I assume you want to fill in the quantities amount and rate in your function tot_with_tax(). In that case you might want to pass in the arguments into the function.

Thus the function handle would be:

def tot_with_tax(amount, rate):

And you would call it by saying:

return in_page(), tot_with_tax_exit(amount, rate), print(tot_with_tax(amount, rate)), loop()

When calling tot_with_tax(), you don't need to name the arguments amount and rate if you don't want to, for example, if you had two states i.e CA and FL, you could pass in:

return tot_with_tax(amount_CA, rate_CA)

or

return tot_with_tax(amount_FL, rate_FL)

And either would get translated into an amount and rate inside the function.

Also one quick tip, you don't want to put in arbitrary parenthesis in python, since that signifies a type of variable called a tuple.

So instead of doing this:

tax = (amount * rate)

Do this:

tax = amount * rate


问:
Sloot Digital Coding System
" In the late 1990s, a Dutch electronics technician named Romke Jan Berhnard Sloot announced the development of the Sloot Digital Coding System, a revolutionary advance in data transmission that, he claimed, could reduce a feature-length movie down to a filesize of just 8KB. The decoding algorithm was 370MB, and apparently Sloot demonstrated this to Philips execs, dazzling them by playing 16 movies at the same time from a 64KB chip. After getting a bunch of investors, he mysteriously died on September 11, 1999"

it's possible or just a story

答:
A very interesting concept. Conceptually, the Sloot encoding premise seems to be that the "receiver" would have a heavy data rich (DRM-Like) program, capable of a large pre-programmed capabilities ready and able to execute complex programming tasks with minimal data instruction.

I am not a programmer, however, at present, current data transfer challenges exist where there seems to be more focus on the "transmission" of the of data (dense and voluminous), versus the capability of the receiving program/hardware. Whereas with Sloot, the emphasis is on the pre-loading of such data (with hardware/software that has much higher capabilities built-in). I hope I'm not saying the obvious here.

As an example, using sound files for simplicity, rather than sending a complex sound file containing say an Mp3 of Vivaldi – The Four Seasons, the coding just instructs the receiver the "musical notes" of the composition, where the system is pre-programmed to play the notes.  Obviously there is more to it than that, however, the concept makes perfect sense.  In other words rather than transmitting "Vivaldi" data rich signal, send simpler instructions to a "Vivaldi" trained receiver.  Don't send the composer, send the instructions to a composer already there.

Yes, movies can contain billions of instructional data under the current system (and that of 1999), however, can beefing up the abilities, the pre-progammed functions, of the receiver achieve what Sloot had figured out?

Currently, the data stream seems to be carrying the load, where instead the receiver should be, as suggested by Sloot.  So, does it make more sense to send the music composer by train to the concert hall across the country, or to send the music notes to another composer who is already there?  This not to be confused with pre-loaded movies being "unlocked", rather that the movie player has infinite abilities that simple coding can instruct within an order of magnitude greater ability.

Just some random thoughts from a layman.

Title: Sloot Digital Coding System