num = int(input("Enter a number: "))
for i in range(1, 11):
print(num, 'x', i, '=', num*i)
#clcoding.com
num = int(input("Enter a number: "))
i = 1
while i <= 10:
print(num, 'x', i, '=', num*i)
i += 1
#clcoding.com
# Prompt the user to enter a number
num = int(input("Enter a number: "))
# Use a list comprehension to print the multiplication table
_ = [print(num, 'x', i, '=', num*i) for i in range(1, 11)]
#clcoding.com
num = int(input("Enter a number: "))
table = list(map(lambda x: num * x, range(1, 11)))
for i in range(10):
print(num, 'x', i+1, '=', table[i])
#clcoding.com
def print_table(num, times=1):
if times > 10:
return
print(num, 'x', times, '=', num * times)
print_table(num, times + 1)
num = int(input("Enter a number: "))
print_table(num)
#clcoding.com
import numpy as np
num = int(input("Enter a number: "))
multiplier = np.arange(1, 11)
result = np.outer([num], multiplier)
# Transpose the matrix before printing
result_transposed = result.T
# Format the output to remove square brackets
for row in result_transposed:
print(*row)
#clcoding.com
import pandas as pd
num = int(input("Enter a number: "))
multiplier = list(range(1, 11))
# Create DataFrame without specifying column labels
df = pd.DataFrame({num: [num * i for i in multiplier]})
# Print DataFrame without column labels
print(df.to_string(header=False, index=False))
#clcoding.com
# Prompt the user to enter a number
num = int(input("Enter a number: "))
# Create a string representation of the multiplication table
table = '\n'.join([f"{num} x {i} = {num * i}" for i in range(1, 11)])
# Print the multiplication table
print(table)
#clcoding.com
0 Comments:
Post a Comment