List the rules involved in declaring variables in python . Explain with examples
1. The variable name should start with a letter or underscore.
2. The variable name should not start with a number.
3. The variable name can only contain letters, numbers, and underscores.
4. Variable names are case sensitive.
5. Avoid using Python keywords as variable names.
Here are some examples of variable declaration in Python:1. Declaring a variable with a string value
message = "Hello, world!"2. Declaring a variable with an integer value
age = 303. Declaring a variable with a float value
temperature = 98.64. Declaring a variable with a boolean value
is_sunny = TrueCreate a UML diagram for the card game Go Fish.
A UML diagram for the card game Go Fish is given below:
The UML Diagram-------------------------
| Player |
-------------------------
| -hand: List<Card> |
| -score: int |
| +getPlayerName(): String|
| +getHand(): List<Card>|
| +getScore(): int |
| +addCardToHand(card: Card): void|
| +removeCardFromHand(card: Card): void|
| +addToScore(points: int): void|
| +hasCard(rank: Rank): boolean|
| +getMatchingCards(rank: Rank): List<Card>|
| +askForCard(player: Player, rank: Rank): List<Card>|
| +goFish(deck: Deck): Card|
-------------------------
| ^
| |
|------------------|
| |
------------------------- |
| Card | |
------------------------- |
| -rank: Rank | |
| -suit: Suit | |
| +getRank(): Rank | |
| +getSuit(): Suit | |
| +toString(): String | |
| +equals(other: Object): boolean|
| +hashCode(): int | |
------------------------- |
| ^
| |
|------------------|
| |
------------------------- |
| Rank | |
------------------------- |
| ACE | |
| TWO | |
| THREE | |
| FOUR | |
| FIVE | |
| SIX | |
| SEVEN | |
| EIGHT | |
| NINE | |
| TEN | |
| JACK | |
| QUEEN | |
| KING | |
------------------------- |
| ^
| |
|------------------|
| |
------------------------- |
| Suit | |
------------------------- |
| CLUBS | |
| DIAMONDS | |
| HEARTS | |
| SPADES | |
------------------------- |
| ^
| |
|------------------|
| |
------------------------- |
| Deck | |
------------------------- |
Read more about UML diagram here:
https://brainly.com/question/13838828
#SPJ1