-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay13_practice.py
More file actions
77 lines (54 loc) · 2.42 KB
/
Day13_practice.py
File metadata and controls
77 lines (54 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
'''Calculate the multiplication and sum of two numbers
Given two integer numbers, write a Python code to return their product only if the product is equal to or lower than 1000. Otherwise, return their sum.'''
# name = input("Enter Your name:\n")
# num1 = int(input(f"Hi {name} Enter the first Number:\n"))
# num2 = int(input(f"{name} Enter the Second Number:\n"))
#
# if num1*num2 <= 1000:
# print("The multiplication of 2 number is : ",num1*num2)
# else:
# print("The Addition of Two Number is :",num1+num2)
'''Write a Python code to iterate the first 10 numbers, and in each iteration, print the sum of the current and previous number.'''
# previous_number = 0
# sum = 0
# for current_number in range(0,11):
# sum = previous_number + current_number
# print(f"Previous number is: {previous_number} Current number is: {current_number} The Sum is :{sum}")
# previous_number = current_number
'''Write a Python code to accept a string from the user and display characters present at an even index number.
For example, str = "PYnative". so your code should display ‘P’, ‘n’, ‘t’, ‘v’.
'''
# user_input = input("Enter The string:\n")
#
# for i in range(0,len(user_input)):
#
# if i % 2 == 0: # Two Ways
# print(user_input[i])
#
# # OR
#
# for i in range(0,len(user_input),2):
#
# print(user_input[i])
'''Remove first n characters from a string
Write a Python code to remove characters from a string from 0 to n and return a new string.
For Example:
remove_chars("PYnative", 4) so output must be tive. Here, you need to remove the first four characters from a string.
remove_chars("PYnative", 2) so output must be native. Here, you need to remove the first two characters from a string.
Note: n must be less than the length of the string.'''
# def removechar(name):
# print(f"Your String is {name}")
# rm = int(input("Enter the number to remove the characters:\n"))
# return name[rm:]
#
# finalstr = removechar("Chandan Gowda")
# print(finalstr)
'''Write a code to return True if the list’s first and last numbers are the same. If the numbers are different, return False.'''
#def same(input_list):
# if input_list[0] == input_list[-1]:
return True
# else:
# return False
#print(same([10,2,3,4,5,10]))
#day 13 of practice
#day 14 no code sorry due to fa exam