Replit is an online IDE that makes it easy for teachers and students to start programming.
These are some basic data types in Python
my_string = "Hello World"
my_int = 5
my_float = 32.4
my_list = ["apple", "banana", "orange", 5]
my_boolean = True
Defintion: An immutable sequence of characters wrapped inside single, double or triple quotes
The print function enables us to print strings to the console using the following syntax.
print("My STRING HERE")
print(f"This is {variable_1} and this is {variable_2}.")
# Program to check if a number is prime or not
num = 29
# To take input from the user
#num = int(input("Enter a number: "))
# define a flag variable
flag = False
# prime numbers are greater than 1
if num > 1:
# check for factors
for i in range(2, num):
if (num % i) == 0:
# if factor is found, set flag to True
flag = True
# break out of loop
break
# check if flag is True
if flag:
print(num, "is not a prime number")
else:
print(num, "is a prime number")
print