Posts

For Loops In Python

CSZONE

File Handling In Python

cszone Write a Python program to read an entire text file.? Write a Python program to read first n lines of a file? Write a Python program to append text to a file and display the text.? Write a Python program to read last n lines of a file.? Write a Python program to read a file line by line store it into a variable. ? Write a Python program to count the number of lines in a text file.? Write a Python program to write a list to a file.? Write a Python program to extract words from text files and puts them into a list.? Write a Python program to rename a file ? Write a Python program to remove a file ?

C || Star Pattern - Triangle

*    **  ***  **** *****

C || Star Pattern - Rectangle

CSZONE ***** ***** ***** ***** *****

File Handling Operation In C Language

CSZONE #include<stdio.h> #include<stdlib.h> #include<string.h> FILE *f; int insert(); int read(); int count(); int main(){     int ch;        system("clear");     printf("\n\t\tFile Handling");        printf("\n\t\tMenu");     printf("\n\t\t1.Write ");     printf("\n\t\t2.Read");     printf("\n\t\t3 Count ");         printf("\n\t\tEnter Your Choice : ");     scanf("%d",&ch);         switch(ch){                 case 1 : insert();                 break;         case 2 : read();                 break;         case 3 : count();                 break;         default: printf("\n\t\tYou Have Entered Wrong Choice.. Try Again...");                 exit(0);     }     return 0;     } int insert(){         char ch[500];         f = fopen("File.c","w");         if(f==NULL){         printf("\n\t\tFile Opening Error.

he challenge here is to read n lines of input until you reach EOF, then number and print all n lines of content. Hint: Java's Scanner.hasNext() method is helpful for this problem.

CSZONE Sample Input Hello world I am a file Read me until end-of-file. Sample Output 1 Hello world 2 I am a file 3 Read me until end-of-file. import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution {     public static void main(String[] args) {         /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */         Scanner scan = new Scanner(System.in);         int i=1;         while(scan.hasNext()){             System.out.println(i + " " + scan.nextLine());             i++;         }     } }

There are three lines of output: For the first line, sum the lengths of A and B. For the second line, write Yes if A is lexicographically greater than B otherwise print No instead. For the third line, capitalize the first letter in both A and B print them on a single line, separated by a space.

CSZONE import java.io.*; import java.util.*; public class Solution { public static String capitalize(String str){ if(str == null ){ return str; }else{ return str.substring(0,1).toUpperCase()+ str.substring(1).toLowerCase(); } } public static void main(String[] args) { Scanner sc=new Scanner(System.in); String A=sc.next(); String B=sc.next(); /* Enter your code here. Print output to STDOUT. */ System.out.println( A.length()+B.length()); if(A.compareTo(B)>0){ System.out.println("Yes"); }else{ System.out.println("No"); } System.out.println(capitalize(A)+" "+capitalize(B)); } }