How to write Cognifyz python internship level one tasks with phone.

How to write Cognifyz python internship level one tasks with phone.

Ā·

4 min read

On 25th November, I received a Python internship offer letter from Cognifyz. I applied for the internship earlier in November, knowing fully well that I don't have a laptop.

Congratulations šŸ„³ to you if you received it too.

After a bit of research, I came across online-python.com, an online editor that I used for the first-level task.

In this tutorial, I will be walking you through how to write the first-level task with your phone.
This tutorial is for people who got into the Cognifyz python internship program but don't have a laptop and also for people struggling to figure out how to perform these tasks.
Before that, let's talk a little about Cognifyz.

Who is Cognifyz

Cognifyz is a leading technology that focuses on delivering impactful solutions covering the domains of artificial intelligence(AI), machine learning(ml), and data analysis.
Cognifyz has excelled at providing innovative and cutting-edge solutions to meet the needs of businesses.
Cognifyz provides training programs to help produce job-ready professionals. Cognifyz offers incentivized internships to reward Python developers and also help them improve their skills.
Now, let's get our hands dirty. Go to online-python.com. It will open up an editor.

Hit the plus icon and rename the file to anything you want, I prefer to call mine first_task.py(for the first task).
We will go over the tasks in the order in which they are in the task list.

Task 1: String reversal code:

This code takes a word and reverses it. For example, it takes ā€œhelloā€ as an input and converts it to ā€œollehā€

# This code reverses a string
word = input('Enter the word you want to reverse...')
reversed_word = ""
for letter in word:
    reversed_word = letter+reversed_word
print(reversed_word)

Task 2: Temperature converter:

This program converts a degree in Celsius to Fahrenheit and vice versa. It takes the unit of the number to be given and the number and returns the converted degree.
Python

# This code converts fahrenheit to Celsius and vice versa
def to_celsius(number):
    # converts Fahrenheit to Celsius
     return (number-32) * (5/9)    
def to_fahrenheit(number):
    # converts from to Celsius to Fahrenheit
     return (number*(9/5)) + 32    
unit = input("Do you want to convert to Fahrenheit or Celsius? ").lower()
number = int(input("Please Enter the number.."))
if "fa" in unit:
    print(to_fahrenheit(number))
elif "ce" in unit:
    print(to_celsius(number))
else:
    print("Enter a valid unit")

Task 3: Email Validator:
The E-mail validator checks if an email address is valid. It uses the re module to check through an address for common features like @ and a domain name.

# checks validity of an email address 
# import the re module
import re 

regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]
+\.[A-Z|a-z]{2,7}\b'

def check_email(email):
    checked = re.fullmatch(regex, email)
    if checked:
        print("valid")
    else:
        print("Invalid.... Enter another email address")


email = input("Enter your email address...")
check_email(email)

Task 4: A calculator

This program performs basic calculation with two numbers such as addition, subtraction, division, multiplication, and modulus

# a calculator that performs +, -, /, *, and %
def add(a, b):
    # add two numbers together
     return a + b

def sub(a, b):
    #subtract two numbers together
     return a - b

def div(a, b):
    # divides a by b
    return a/b

def mul(a, b):
    # multiplies a by b
    return a*b

def rem(a,b):
    # check for remainder
     return a%b

operation = input('do you want to add, subtract, divide, multiply or find the remainder of two numbers ').lower()
first_num = int(input('Enter the first number '))
second_num = int(input('Enter the second number '))
if "ad" in operation:
    print(add(first_num, second_num))
elif "mu" in operation:
    print(mul(first_num, second_num))
elif "su" in operation:
    print(sub(first_num, second_num))
elif "di" in operation:
    print(div(first_num, second_num))
elif "re" in operation:
    print(rem(first_num, second_num))
else:
    print("enter a valid operation")

Task 5: palindrome checker :

A palindrome is a word that remains the same when reversed. For example, madam, dad, racecar.
This program builds on the string reversal code to achieve this purpose.

# palindrome checker
# This code checks if a word is a palindrome
word = input('Enter the word you want to check...').lower()
reversed_word = ""
for letter in word:
        reversed_word = letter+reversed_word
if reversed_word == word:
    print("This word is a palindrome")
else:
    print("This word is not a palindrome.")

I hope this article was able to solve your problem. The code snippets are to give you an insight into how to solve the problem. Do not copy verbatim as plagiarism is against the terms and conditions of the internship. I wish you good luck. I can't wait to see what your solutions will look like, please drop your codes in the comments section.
If this article was helpful, share it with your friends So that they can benefit too.
Follow me on x @kelvinuche_ for more valuable content.
Level two tasks solutions loadingā€¦..

Ā