-
Notifications
You must be signed in to change notification settings - Fork 0
Labs
Write a program that asks for a number and outputs if the number is odd or even.
Give me a number: 5
> Your number 5 is an odd number.
- Hint: What does Modulus do again?
Please view the solution after you have attempted it on your own.
Write a program that picks a random number from 1-10. Then ask a user to guess the number. Output if the guess was correct or not.
I'm thinking of a number between 1-10, what is it? 5
> Sorry, the number was 7.
- Hint: There a library that can pick a random number.
Please view the solution after you have attempted it on your own.
Write a program that plays the game rock, paper, scissors with a user.
Have your program generate a random answer for the computer, but don't display it. Then, ask the player for their answer.
- Paper wins over Rock
- Rock wins over Scissors
- Scissors win over Paper
Ready to play Rock Paper Scissors?
What do you pick? Rock
> I choose Scissors. You won!
- Bonus: Do this in a loop. Best of 3.
Please view the solution after you have attempted it on your own.
You can calculate an individual's weight on another planet by multiplying their weight times the relative surface gravity of the other world.
Weight on Other Planet = Weight on Earth x Multiple of Earth’s Gravity
Design a Python program that asks a user for their name and weight. The program will greet the user by name and then calculate/display the user's weight on the other planets. Each item should be displayed on a line by itself.
- Body - Multiple of Earth's Gravity
- Sun - 27.01
- Mercury - .38
- Venus - .91
- Earth - 1
- Moon - .166
- Mars - .38
- Jupiter - 2.34
- Saturn - 1.06
- Uranus - .92
- Neptune - 1.19
- Pluto - .06
Please view the solution after you have attempted it on your own.
- Given a tax rate of %8.75, prompt user for cost of a meal and how much to tip as a percentage.
- Output to user this information.
- Cost of meal
- Cost of tax
- Cost of tip
- Total Meal Cost
Please view the solution after you have attempted it on your own.