This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
this is the 8th exercise of practice python | |
''' | |
''' | |
Make a two-player Rock-Paper-Scissors game. (Hint: Ask for player plays (using input), compare them, print out a message of congratulations to the winner, and ask if the players want to start a new game) | |
Remember the rules: | |
•Rock beats scissors | |
•Scissors beats paper | |
•Paper beats rock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
this is practicepython exercise - 7 | |
''' | |
''' | |
Let’s say I give you a list saved in a variable: a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]. | |
Write one line of Python that takes this list a and makes a new list that has only the even elements of this list in it. | |
''' | |
import random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This is the 6th exercise of practicepython | |
''' | |
''' | |
Exercise (and Solution) | |
Ask the user for a string and print out whether this string is a palindrome or not. | |
(A palindrome is a string that reads the same forwards and backwards.) | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
this is the 5th exercise from practicepython | |
''' | |
''' | |
Exercise (and Solution) | |
Take two lists, say for example these two: | |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
this is practice python 5th exercise | |
''' | |
''' | |
Take two lists, say for example these two: | |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This is the 4th exercise of PracticePython | |
''' | |
''' | |
Create a program that asks the user for a number and then prints out a list of all the divisors of that number. (If you don’t know what a divisor is, it is a number that divides evenly into another number. | |
For example, 13 is a divisor of 26 because 26 / 13 has no remainder.) | |
''' | |
#mycode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This is 3rd Exercise from practicepython.org | |
''' | |
''' | |
Take a list, say for example this one: | |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
and write a program that prints out all the elements of the list that are less than 5. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This is the 2nd exercise from http://www.practicepython.org/exercises/ | |
''' | |
''' | |
Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user. Hint: how does an even / odd number react differently when divided by 2? | |
Extras: | |
1.If the number is a multiple of 4, print out a different message. | |
2.Ask the user for two numbers: one number to check (call it num) and one number to divide by (check). If check divides evenly into num, tell that to the user. If not, print a different appropriate message. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# According to user input calculate their 100 th age year | |
import datetime | |
def calculate100Year(getYear): | |
get = datetime.datetime.now() | |
currYear = get.year | |
getYear = (100- getYear) + currYear | |
return getYear | |
name = input("Enter Your Name") | |
age = int(input("Enter Your Age")) |