Caps and Lower caps printer

print("VEEVERSE")
print("Sign up")
name_1 = input("First name: ").upper()
name_2 = input("Surname: ").upper()
email = input ("Email: ").lower()
print("___________________________________________________")
print("Welcome to Veeverse, You have successfully signed up")
print("Name: " , name_1 + name_2)
print("Email: ", email)

# Output 
#VEEVERSE
#Sign up 
#First name: Victoria 
#Surname: Iheukwumere 
#Email:Veeverse123@hashnode.com
______________________________________________________
#Welcome to Veeverse, You have successfully signed up
#Name:  VICTORIA IHEUKWUMERE 
#Email:  veeverse123@hashnode.com

Number Operator

print("Welcome to Vkay's Simple Calculator")
first_number = float(input("Enter first number:"))
second_number = float(input("Enter second number: "))
print("Sum of numbers =", first_number + second_number)
print("Difference between numbers =", first_number - second_number)
print("Product of numbers =", first_number * second_number)
print("Division of numbers =", first_number/ second_number)

#Output
#Welcome to Vkay's Simple Calculator 
#Enter first number:10
#Enter second number:10
#Sum of numbers = 20
#Difference between numbers = 0
#Product of numbers = 100
#Division of numbers = 1
  1. Why Zero based indexing is used in programming languages: The use of zero-based indexing in programming languages is a convention that has historical and practical reasons. While it may seem counterintuitive at first, there are several advantages to using zero-based indexing:

a) Simplicity and consistency: Zero-based indexing simplifies the logic and calculations involved in array and string manipulation. It provides a consistent and straightforward way to access elements in data structures.

b)Memory addressing: In many programming languages, arrays are implemented as contiguous blocks of memory. Using zero-based indexing aligns with how memory is addressed and allows for efficient pointer arithmetic.

Imagine you have a row of houses, and you want to refer to each house by its position. If you start counting from one, the first house would be labeled as House 1, the second house as House 2, and so on. However, in computer programming, we start counting from zero. So the first house would be labeled as House 0, the second house as House 1, and so on.The reason for this is how computer memory is organized. When you work with a collection of items like an array, the computer stores them in a specific order in its memory. To access a particular item in the collection, the computer needs to know where it is located in memory. By starting the counting at zero, the computer can calculate the memory address of an item more easily and quickly.

c) C programming language influence: The convention of zero-based indexing is widely used in programming languages influenced by or derived from the C programming language. C, which was developed in the early 1970s, used zero-based indexing, and subsequent languages such as C++, Java, Python, and many others adopted this convention for consistency and compatibility.

d) Mathematical alignment: Zero-based indexing aligns with mathematical notation and concepts. In mathematics, when counting objects in a set, the first element is often referred to as the "zeroth" element. By starting indexing at zero, programming languages align with this mathematical convention.

While it might feel a bit strange at first, starting indexes at zero has become a convention in programming because it makes things work smoothly and efficiently for computers.While zero-based indexing has its advantages, it's worth noting that not all programming languages follow this convention. Some languages, like Fortran, Pascal, and MATLAB, use one-based indexing, where the first element of an array is accessed using the index 1. Different indexing conventions can cause confusion when working with code across different languages, so it's important to be aware of the indexing conventions of the language you're working with.

In Python, there are numerous methods and functions available for manipulating strings. These built-in methods and functions allow you to perform various operations on strings, such as changing case, finding substrings, splitting strings, and more. Let's explore some of the commonly used methods and functions for string manipulation in Python:

1. **len()**: This function returns the length of a string by counting the number of characters in the string. For example, `len("Hello")` will return 5

print (len("Hello")
#Output = 5

2. **strip()**: This method removes leading and trailing whitespace characters from a string. For example,

greetings="    Good morning " 
print (greetings.strip())
# Output:Good morning

3. **split()**: This method splits a string into a list of substrings based on a specified delimiter. For example,

print ( "Hello World".split())
#output ["Hello", "World"]

4. **join()**: This method joins the elements of an iterable (such as a list) into a string, using a specified delimiter. For example,

mylist = ["John", "Peter", "Vicky"]
joined_names= "-".join(mylist)
print(joined_names)
#Output john-Peter-Vicky

5. **replace()**: This method replaces all occurrences of a specified substring with another substring in a string. For example,

print("Hello blog")
"Hello blog".replace("blog", "world") 
#Output Hello world

6)**starts with ()**: This method checks if a string starts with a specified substring. It returns True if the string starts with the substring, and False otherwise. For eg:

`"Hello blog".startswith("Hello")` 
#Output: True

9. **endswith()**: This method checks if a string ends with a specified substring. It returns True if the string ends with the substring, and False otherwise. For example,

"Hello blog".endswith("blog")`
 #Output True

10. **find()**: This method searches for a specified substring within a string and returns the index of the first occurrence. If the substring is not found, it returns -1. For example,

"Hello blog".find("blog") 
 #Output 6

N/B: Concatenations andcase convertions were used in the above exercise 1

These are just a few examples of the many methods and functions available for manipulating strings in Python.

Apart from `sum`, `len`, `max`, and `min`, there are several other functions that can be used on numbers or lists. Here are a few examples:

For Numbers:

ii) Mathematical Functions: Programming languages often provide a wide range of mathematical functions that can be used on numbers.

These functions include functions like

a)abs()` for absolute value:

x= abs(-8)
print(x)
#output 8

b)divmod() Returns the quotient and the remainder when argument1 is divided by argument2

x = divmod(7, 2)
print (x)
#(3,1)

ii) Random Number Generation: Functions like `random()` or`rand()` generate random numbers within a specified range. They can be useful for simulations, games, or generating random values.

Python does not have a random() function to make a random number, but Python has a built-in module called random that can be used to make random numbers:

Example

Import the random module, and display a random number between 1 and 12

import random
print(random.randrange(1, 10))
#output 10

c. Trigonometric Functions: Trigonometric functions like sine (`sin()`), cosine (`cos()`), tangent (`tan()`), and their inverses are available in most programming languages. They are used for various mathematical and scientific calculations.

d. Type Conversion: Functions for converting numbers between different data types are often available. For example, `int()` converts a floating-point number to an integer, `float()` converts an integer or string to a floating-point number, and `str()` converts a number to a string representation.

x = 1    # int
y = 3.2  # float
#convert from int to float:
a =float(x)
print (a)
#1.0
#convert float to int
b= int(y)
print (b)
#3