Integers in Python

Integers are whole numbers, which can be positive, negative, or zero, and do not have decimal points. In Python, you can perform various arithmetic operations with integers, making them essential for calculations and counting.

# Player Scores
player1_score = 45  # Player 1's score
player2_score = 30  # Player 2's score

# Displaying Scores
print("Player 1 Score:", player1_score)
print("Player 2 Score:", player2_score)
print("-" * 30)

# Total Score Calculation
total_score = player1_score + player2_score
print("Total Score:", total_score)  # Sum of both scores

# Score Difference
score_difference = player1_score - player2_score
print("Score Difference:", score_difference)  # Difference between scores

# Multiplying Scores
print("Player 1 Score multiplied by 2:", player1_score * 2)  # Multiplication

Player 1 Score: 45
Player 2 Score: 30
------------------------------
Total Score: 75
Score Difference: 15
Player 1 Score multiplied by 2: 90

Javascript Version

%%js
// Player Scores
let player1_score = 45; // Player 1's score
let player2_score = 30; // Player 2's score

// Displaying Scores
console.log("Player 1 Score:", player1_score);
console.log("Player 2 Score:", player2_score);
console.log("-".repeat(30));

// Total Score Calculation
let total_score = player1_score + player2_score;
console.log("Total Score:", total_score); // Sum of both scores

// Score Difference
let score_difference = player1_score - player2_score;
console.log("Score Difference:", score_difference); // Difference between scores

// Multiplying Scores
console.log("Player 1 Score multiplied by 2:", player1_score * 2); // Multiplication

<IPython.core.display.Javascript object>